public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 3/7] drm/i915/guc: add enable_guc_loading parameter
Date: Mon, 16 May 2016 20:07:31 +0100	[thread overview]
Message-ID: <573A1A73.2040005@intel.com> (raw)
In-Reply-To: <5735F369.3010601@linux.intel.com>

On 13/05/16 16:31, Tvrtko Ursulin wrote:
>
> On 13/05/16 15:36, Dave Gordon wrote:
>> Split the function of "enable_guc_submission" into two separate
>> options.  The new one ("enable_guc_loading") controls only the
>> *fetching and loading* of the GuC firmware image. The existing
>> one is redefined to control only the *use* of the GuC for batch
>> submission once the firmware is loaded.
>>
>> In addition, the degree of control has been refined from a simple
>> bool to an integer key, allowing several options:
>> -1 (default)     whatever the platform default is
>>   0  DISABLE      don't load/use the GuC
>>   1  BEST EFFORT  try to load/use the GuC, fallback if not available
>>   2  REQUIRE      must load/use the GuC, else leave the GPU wedged
>>
>> The new platform default (as coded here) will be to attempt to
>> load the GuC iff the device has a GuC that requires firmware,
>> but not yet to use it for submission. A later patch will change
>> to enable it if appropriate.
>>
>> v4:
>>      Changed some error-message levels, mostly ERROR->INFO, per
>>      review comments by Tvrtko Ursulin.
>>
>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_gem.c            |   1 -
>>   drivers/gpu/drm/i915/i915_guc_submission.c |   4 +-
>>   drivers/gpu/drm/i915/i915_params.c         |  14 +++-
>>   drivers/gpu/drm/i915/i915_params.h         |   3 +-
>>   drivers/gpu/drm/i915/intel_guc_loader.c    | 108
>> ++++++++++++++++-------------
>>   5 files changed, 76 insertions(+), 54 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c
>> b/drivers/gpu/drm/i915/i915_gem.c
>> index 2a7be71..2bf8743 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -4870,7 +4870,6 @@ int i915_gem_init_engines(struct drm_device *dev)
>>           ret = intel_guc_setup(dev);
>>           if (ret) {
>>               DRM_ERROR("Failed to initialize GuC, error %d\n", ret);
>
> This error msg should go as well I think.

Yes, if we reach this we'll have just printed a message in 
intel_guc_setup() so we don't really need both.

>> -            ret = -EIO;
>>               goto out;
>>           }
>>       }
>> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c
>> b/drivers/gpu/drm/i915/i915_guc_submission.c
>> index 169242a..916cd67 100644
>> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
>> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
>> @@ -969,7 +969,7 @@ int intel_guc_suspend(struct drm_device *dev)
>>       struct intel_context *ctx;
>>       u32 data[3];
>>
>> -    if (!i915.enable_guc_submission)
>> +    if (guc->guc_fw.guc_fw_load_status != GUC_FIRMWARE_SUCCESS)
>>           return 0;
>>
>>       ctx = dev_priv->kernel_context;
>> @@ -995,7 +995,7 @@ int intel_guc_resume(struct drm_device *dev)
>>       struct intel_context *ctx;
>>       u32 data[3];
>>
>> -    if (!i915.enable_guc_submission)
>> +    if (guc->guc_fw.guc_fw_load_status != GUC_FIRMWARE_SUCCESS)
>>           return 0;
>
> Will the above two do the right thing for the fw_path == NULL case? That
> is !HAS_GUC_UCODE && HAS_GUC_SCHED? Looks like load status will bt NONE
> in that case, GuC submission will be enabled and suspend and resume
> hooks will be skipped?
>
> Maybe fetch and load status should be set to success on such platforms?

I think probably fetch==NONE but load==SUCCESS, in which case the code 
above will be correct already. OTOH there aren't actually any such 
platforms yet, and intel_guc_setup() doesn't really support this fully; 
for instance, we don't know whether the correct behaviour of _setup() on 
such a hypothetical platform would be to reset the GuC and just skip the 
DMA, or to skip the reset as well. Certainly some of the setup would 
still be required.

So for now I've forced GuC submission off for any such platform, so the 
code above should be OK for the four possibilities (no GuC, GuC not 
loaded, GuC loaded but not used for submission, GuC loaded and in use).

We can revisit this in the event that a firmware-free GuC ever appears!

[snip]

>> @@ -486,7 +474,6 @@ int intel_guc_setup(struct drm_device *dev)
>>       return 0;
>>
>>   fail:
>> -    DRM_ERROR("GuC firmware load failed, err %d\n", err);
>>       if (guc_fw->guc_fw_load_status == GUC_FIRMWARE_PENDING)
>>           guc_fw->guc_fw_load_status = GUC_FIRMWARE_FAIL;
>>
>> @@ -494,7 +481,36 @@ int intel_guc_setup(struct drm_device *dev)
>>       i915_guc_submission_disable(dev);
>>       i915_guc_submission_fini(dev);
>>
>> -    return err;
>> +    /*
>> +     * We've failed to load the firmware :(
>> +     *
>> +     * Decide whether to disable GuC submission and fall back to
>> +     * execlist mode, and whether to hide the error by returning
>> +     * zero or to return -EIO, which the caller will treat as a
>> +     * nonfatal error (i.e. it doesn't prevent driver load, but
>> +     * marks the GPU as wedged until reset).
>> +     */
>> +    if (i915.enable_guc_loading > 1) {
>> +        ret = -EIO;
>> +    } else if (HAS_GUC_SCHED(dev) && !HAS_GUC_UCODE(dev)) {
>> +        /* This GuC works even without firmware :) */
>> +        return 0;
>> +    } else if (i915.enable_guc_submission > 1) {
>> +        ret = -EIO;
>> +    } else {
>> +        ret = 0;
>> +    }
>> +
>> +    if (ret == -EIO)
>> +        DRM_ERROR("GuC firmware load failed, err %d\n", err);
>> +    else
>> +        DRM_INFO("GuC firmware load failed, err %d\n", err);
>> +
>> +    if (i915.enable_guc_submission)
>> +        DRM_INFO("falling back to execlist mode, ret %d\n", ret);
>
> ret is always zero in this msg?

I shouldn't think so; AFAICS it could also be -EIO. This message can be 
printed in conjunction with either variant of the message above.

.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-05-16 19:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 14:36 [PATCH v4 0/7] Enable GuC submission Dave Gordon
2016-05-13 14:36 ` [PATCH v4 1/7] drm/i915/guc: rename loader entry points Dave Gordon
2016-05-13 15:11   ` Tvrtko Ursulin
2016-05-13 14:36 ` [PATCH v4 2/7] drm/i915/guc: distinguish HAS_GUC() from HAS_GUC_UCODE/HAS_GUC_SCHED Dave Gordon
2016-05-13 15:34   ` Tvrtko Ursulin
2016-05-13 14:36 ` [PATCH v4 3/7] drm/i915/guc: add enable_guc_loading parameter Dave Gordon
2016-05-13 15:31   ` Tvrtko Ursulin
2016-05-16 19:07     ` Dave Gordon [this message]
2016-05-16 19:12     ` [PATCH v5 " Dave Gordon
2016-05-17  9:08       ` Tvrtko Ursulin
2016-05-20 11:40         ` Fiedorowicz, Lukasz
2016-05-20 10:42       ` [PATCH v6 " Tvrtko Ursulin
2016-05-20 14:04         ` Fiedorowicz, Lukasz
2016-05-23 13:17         ` Nick Hoath
2016-05-13 14:36 ` [PATCH v4 4/7] drm/i915/guc: pass request (not client) to i915_guc_{wq_check_space, submit}() Dave Gordon
2016-05-13 14:36 ` [PATCH v4 5/7] drm/i915/guc: don't spinwait if the GuC's workqueue is full Dave Gordon
2016-05-13 15:32   ` Tvrtko Ursulin
2016-05-13 14:36 ` [PATCH v4 6/7] drm/i915/guc: rework guc_add_workqueue_item() Dave Gordon
2016-05-13 14:36 ` [PATCH v4 7/7] drm/i915/guc: change default to using GuC submission if possible Dave Gordon
2016-05-14  8:32   ` Chris Wilson
2016-05-13 16:34 ` ✗ Ro.CI.BAT: failure for Enable GuC submission Patchwork
2016-05-17  5:24 ` ✗ Ro.CI.BAT: failure for Enable GuC submission (rev2) Patchwork
2016-05-20 11:15 ` ✗ Ro.CI.BAT: failure for Enable GuC submission (rev3) Patchwork
2016-05-23 13:24   ` Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=573A1A73.2040005@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox