Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe/vf: Mark supported firmwares as preloaded
Date: Mon, 8 Apr 2024 14:38:23 +0200	[thread overview]
Message-ID: <20240408123823.ci67mmvqkktoostw@intel.com> (raw)
In-Reply-To: <20240404173814.715-1-michal.wajdeczko@intel.com>

Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on czw [2024-kwi-04 19:38:14 +0200]:
> On current platforms supported firmwares, like GuC and HuC, must
> be loaded by the PF driver.  Mark those firmwares as 'preloaded'
> so we will skip fetching and loading them on the VF drivers but
> still correctly report them as 'running'.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_uc_fw.c       | 11 +++++++++++
>  drivers/gpu/drm/xe/xe_uc_fw.h       |  8 ++++++--
>  drivers/gpu/drm/xe/xe_uc_fw_types.h |  3 ++-
>  3 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_uc_fw.c b/drivers/gpu/drm/xe/xe_uc_fw.c
> index 6adca3a0427c..f27e96c47baa 100644
> --- a/drivers/gpu/drm/xe/xe_uc_fw.c
> +++ b/drivers/gpu/drm/xe/xe_uc_fw.c
> @@ -17,6 +17,7 @@
>  #include "xe_map.h"
>  #include "xe_mmio.h"
>  #include "xe_module.h"
> +#include "xe_sriov.h"
>  #include "xe_uc_fw.h"
>  
>  /*
> @@ -652,7 +653,17 @@ static int uc_fw_request(struct xe_uc_fw *uc_fw, const struct firmware **firmwar
>  	xe_assert(xe, !uc_fw->path);
>  
>  	uc_fw_auto_select(xe, uc_fw);
> +
> +	if (IS_SRIOV_VF(xe)) {
> +		/* VF will support only firmwares that driver can autoselect */
> +		xe_uc_fw_change_status(uc_fw, uc_fw->path ?
> +				       XE_UC_FIRMWARE_PRELOADED :
> +				       XE_UC_FIRMWARE_NOT_SUPPORTED);
> +		return 0;
> +	}
> +
>  	uc_fw_override(uc_fw);
> +
>  	xe_uc_fw_change_status(uc_fw, uc_fw->path ?
>  			       XE_UC_FIRMWARE_SELECTED :
>  			       XE_UC_FIRMWARE_NOT_SUPPORTED);
> diff --git a/drivers/gpu/drm/xe/xe_uc_fw.h b/drivers/gpu/drm/xe/xe_uc_fw.h
> index 85c20795d1f8..35078038797e 100644
> --- a/drivers/gpu/drm/xe/xe_uc_fw.h
> +++ b/drivers/gpu/drm/xe/xe_uc_fw.h
> @@ -59,6 +59,8 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status)
>  		return "TRANSFERRED";
>  	case XE_UC_FIRMWARE_RUNNING:
>  		return "RUNNING";
> +	case XE_UC_FIRMWARE_PRELOADED:
> +		return "PRELOADED";
>  	}
>  	return "<invalid>";
>  }
> @@ -85,6 +87,7 @@ static inline int xe_uc_fw_status_to_error(enum xe_uc_fw_status status)
>  	case XE_UC_FIRMWARE_LOADABLE:
>  	case XE_UC_FIRMWARE_TRANSFERRED:
>  	case XE_UC_FIRMWARE_RUNNING:
> +	case XE_UC_FIRMWARE_PRELOADED:
>  		return 0;
>  	}
>  	return -EINVAL;
> @@ -134,7 +137,8 @@ static inline bool xe_uc_fw_is_available(struct xe_uc_fw *uc_fw)
>  
>  static inline bool xe_uc_fw_is_loadable(struct xe_uc_fw *uc_fw)
>  {
> -	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE;
> +	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE &&
> +		__xe_uc_fw_status(uc_fw) != XE_UC_FIRMWARE_PRELOADED;
>  }
>  
>  static inline bool xe_uc_fw_is_loaded(struct xe_uc_fw *uc_fw)
> @@ -144,7 +148,7 @@ static inline bool xe_uc_fw_is_loaded(struct xe_uc_fw *uc_fw)
>  
>  static inline bool xe_uc_fw_is_running(struct xe_uc_fw *uc_fw)
>  {
> -	return __xe_uc_fw_status(uc_fw) == XE_UC_FIRMWARE_RUNNING;
> +	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_RUNNING;
>  }
>  
>  static inline bool xe_uc_fw_is_overridden(const struct xe_uc_fw *uc_fw)
> diff --git a/drivers/gpu/drm/xe/xe_uc_fw_types.h b/drivers/gpu/drm/xe/xe_uc_fw_types.h
> index bc800b696866..0d8caa0e7354 100644
> --- a/drivers/gpu/drm/xe/xe_uc_fw_types.h
> +++ b/drivers/gpu/drm/xe/xe_uc_fw_types.h
> @@ -50,7 +50,8 @@ enum xe_uc_fw_status {
>  	XE_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
>  	XE_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
>  	XE_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
> -	XE_UC_FIRMWARE_RUNNING /* init/auth done */
> +	XE_UC_FIRMWARE_RUNNING, /* init/auth done */
> +	XE_UC_FIRMWARE_PRELOADED, /* preloaded by the PF driver */

LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>


>  };
>  
>  enum xe_uc_fw_type {
> -- 
> 2.43.0
> 

-- 

      parent reply	other threads:[~2024-04-08 12:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 17:38 [PATCH] drm/xe/vf: Mark supported firmwares as preloaded Michal Wajdeczko
2024-04-04 19:11 ` ✓ CI.Patch_applied: success for " Patchwork
2024-04-04 19:11 ` ✓ CI.checkpatch: " Patchwork
2024-04-04 19:12 ` ✓ CI.KUnit: " Patchwork
2024-04-04 19:24 ` ✓ CI.Build: " Patchwork
2024-04-04 19:31 ` ✓ CI.Hooks: " Patchwork
2024-04-04 19:33 ` ✓ CI.checksparse: " Patchwork
2024-04-04 20:00 ` ✓ CI.BAT: " Patchwork
2024-04-08 12:57   ` Michal Wajdeczko
2024-04-08 12:38 ` Piotr Piórkowski [this message]

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=20240408123823.ci67mmvqkktoostw@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@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