From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Ye, Tony" <tony.ye@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/huc: Fix error reported by I915_PARAM_HUC_STATUS
Date: Tue, 25 Feb 2020 23:02:34 +0100 [thread overview]
Message-ID: <6515f56a-3cd0-589e-54f8-0351b1dd18cc@intel.com> (raw)
In-Reply-To: <c71b8087-9159-20ce-51c7-a862fb26b386@intel.com>
On 25.02.2020 08:49, Ye, Tony wrote:
>
>
> On 2/21/2020 11:32 PM, Michal Wajdeczko wrote:
>> From commit 84b1ca2f0e68 ("drm/i915/uc: prefer intel_gt over i915
>> in GuC/HuC paths") we stopped using HUC_STATUS error -ENODEV only
>> to indicate lack of HuC hardware and we started to use this error
>> also for all other cases when HuC was not in use or supported.
>>
>> Fix that by relying again on HAS_GT_UC macro, since currently
>> used function intel_huc_is_supported() is based on HuC firmware
>> support which could be unsupported also due to force disabled
>> GuC firmware.
>>
>> v2: use 0 only for disabled, add more error codes for other failures
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Tony Ye <tony.ye@intel.com>
>> Cc: Robert M. Fosha <robert.m.fosha@intel.com>
>> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> #v1
>> ---
>> drivers/gpu/drm/i915/gt/uc/intel_huc.c | 29 +++++++++++++++++++++-----
>> 1 file changed, 24 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
>> b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
>> index a74b65694512..301bb5d5e59a 100644
>> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
>> @@ -200,9 +200,13 @@ int intel_huc_auth(struct intel_huc *huc)
>> * This function reads status register to verify if HuC
>> * firmware was successfully loaded.
>> *
>> - * Returns: 1 if HuC firmware is loaded and verified,
>> - * 0 if HuC firmware is not loaded and -ENODEV if HuC
>> - * is not present on this platform.
>> + * Returns:
>> + * * 1 if HuC firmware is loaded and verified,
>> + * * 0 if HuC firmware was disabled,
>> + * * -ENODEV if HuC is not present on this platform,
>> + * * -ENOPKG if HuC firmware was not installed,
>> + * * -ENOEXEC if HuC firmware is invalid,
>> + * * -EACCES if HuC firmware was not authenticated.
>> */
>> int intel_huc_check_status(struct intel_huc *huc)
>> {
>> @@ -210,11 +214,26 @@ int intel_huc_check_status(struct intel_huc *huc)
>> intel_wakeref_t wakeref;
>> u32 status = 0;
>> - if (!intel_huc_is_supported(huc))
>> + if (!HAS_GT_UC(gt->i915))
>> return -ENODEV;
>> + switch (__intel_uc_fw_status(&huc->fw)) {
>> + case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
>> + case INTEL_UC_FIRMWARE_DISABLED:
>> + return 0;
>> + case INTEL_UC_FIRMWARE_MISSING:
>> + return -ENOPKG;
>> + case INTEL_UC_FIRMWARE_ERROR:
>> + return -ENOEXEC;
>
> What about INTEL_UC_FIRMWARE_FAIL?
I assumed that we don't need to handle that case here, since we are
still checking HuC status register below.
But if you want we can improve:
1) return early if FAIL, then check register anyway
2) return early if FAIL, trust fw state and return 1 without checking
register (as same register was already checked when we mark fw state as
RUNNING)
>
> Regards,
> Tony
>
>> + default:
>> + break;
>> + }
>> +
>> with_intel_runtime_pm(gt->uncore->rpm, wakeref)
>> status = intel_uncore_read(gt->uncore, huc->status.reg);
>> - return (status & huc->status.mask) == huc->status.value;
>> + if ((status & huc->status.mask) != huc->status.value)
>> + return -EACCES;
>> +
>> + return 1;
>> }
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-02-25 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 15:32 [Intel-gfx] [PATCH v2] drm/i915/huc: Fix error reported by I915_PARAM_HUC_STATUS Michal Wajdeczko
2020-02-22 0:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/huc: Fix error reported by I915_PARAM_HUC_STATUS (rev2) Patchwork
2020-02-25 7:49 ` [Intel-gfx] [PATCH v2] drm/i915/huc: Fix error reported by I915_PARAM_HUC_STATUS Ye, Tony
2020-02-25 22:02 ` Michal Wajdeczko [this message]
2020-02-27 14:49 ` Ye, Tony
2020-02-27 7:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/huc: Fix error reported by I915_PARAM_HUC_STATUS (rev2) Patchwork
2020-02-28 4:58 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=6515f56a-3cd0-589e-54f8-0351b1dd18cc@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=tony.ye@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