Commit 801a0caa authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Chris Wilson

drm/i915/huc: make "support huc" reflect HW capabilities

We currently initialize HuC support based on GuC being enabled in
modparam; this means that huc_is_supported() can return false on HW that
does have a HuC when enable_guc=0. The rationale for this behavior is
that HuC requires GuC for authentication and therefore is not supported
by itself. However, we do not allow defining HuC fw wthout GuC fw and
selecting HuC in modparam implicitly selects GuC as well, so we can't
actually hit a scenario where HuC is selected alone. Therefore, we can
flip the support check to reflect the HW capabilities and fw
availability, which is more intuitive and will make it cleaner to log
HuC the difference between not supported in HW and not selected.

Removing the difference between GuC and HuC also allows us to simplify
the init_early, since we don't need to differentiate the support based
on the type of uC.
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@intel.com>
Reviewed-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200326181121.16869-4-daniele.ceraolospurio@intel.com
parent 708249a6
...@@ -169,7 +169,7 @@ void intel_guc_init_early(struct intel_guc *guc) ...@@ -169,7 +169,7 @@ void intel_guc_init_early(struct intel_guc *guc)
{ {
struct drm_i915_private *i915 = guc_to_gt(guc)->i915; struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
intel_guc_fw_init_early(guc); intel_uc_fw_init_early(&guc->fw, INTEL_UC_FW_TYPE_GUC);
intel_guc_ct_init_early(&guc->ct); intel_guc_ct_init_early(&guc->ct);
intel_guc_log_init_early(&guc->log); intel_guc_log_init_early(&guc->log);
intel_guc_submission_init_early(guc); intel_guc_submission_init_early(guc);
......
...@@ -13,20 +13,6 @@ ...@@ -13,20 +13,6 @@
#include "intel_guc_fw.h" #include "intel_guc_fw.h"
#include "i915_drv.h" #include "i915_drv.h"
/**
* intel_guc_fw_init_early() - initializes GuC firmware struct
* @guc: intel_guc struct
*
* On platforms with GuC selects firmware for uploading
*/
void intel_guc_fw_init_early(struct intel_guc *guc)
{
struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
intel_uc_fw_init_early(&guc->fw, INTEL_UC_FW_TYPE_GUC, HAS_GT_UC(i915),
INTEL_INFO(i915)->platform, INTEL_REVID(i915));
}
static void guc_prepare_xfer(struct intel_uncore *uncore) static void guc_prepare_xfer(struct intel_uncore *uncore)
{ {
u32 shim_flags = GUC_DISABLE_SRAM_INIT_TO_ZEROES | u32 shim_flags = GUC_DISABLE_SRAM_INIT_TO_ZEROES |
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
struct intel_guc; struct intel_guc;
void intel_guc_fw_init_early(struct intel_guc *guc);
int intel_guc_fw_upload(struct intel_guc *guc); int intel_guc_fw_upload(struct intel_guc *guc);
#endif #endif
...@@ -41,7 +41,7 @@ void intel_huc_init_early(struct intel_huc *huc) ...@@ -41,7 +41,7 @@ void intel_huc_init_early(struct intel_huc *huc)
{ {
struct drm_i915_private *i915 = huc_to_gt(huc)->i915; struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
intel_huc_fw_init_early(huc); intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC);
if (INTEL_GEN(i915) >= 11) { if (INTEL_GEN(i915) >= 11) {
huc->status.reg = GEN11_HUC_KERNEL_LOAD_INFO; huc->status.reg = GEN11_HUC_KERNEL_LOAD_INFO;
......
...@@ -7,23 +7,6 @@ ...@@ -7,23 +7,6 @@
#include "intel_huc_fw.h" #include "intel_huc_fw.h"
#include "i915_drv.h" #include "i915_drv.h"
/**
* intel_huc_fw_init_early() - initializes HuC firmware struct
* @huc: intel_huc struct
*
* On platforms with HuC selects firmware for uploading
*/
void intel_huc_fw_init_early(struct intel_huc *huc)
{
struct intel_gt *gt = huc_to_gt(huc);
struct intel_uc *uc = &gt->uc;
struct drm_i915_private *i915 = gt->i915;
intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC,
intel_uc_wants_guc(uc),
INTEL_INFO(i915)->platform, INTEL_REVID(i915));
}
/** /**
* intel_huc_fw_upload() - load HuC uCode to device * intel_huc_fw_upload() - load HuC uCode to device
* @huc: intel_huc structure * @huc: intel_huc structure
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
struct intel_huc; struct intel_huc;
void intel_huc_fw_init_early(struct intel_huc *huc);
int intel_huc_fw_upload(struct intel_huc *huc); int intel_huc_fw_upload(struct intel_huc *huc);
#endif #endif
...@@ -11,16 +11,22 @@ ...@@ -11,16 +11,22 @@
#include "intel_uc_fw_abi.h" #include "intel_uc_fw_abi.h"
#include "i915_drv.h" #include "i915_drv.h"
static inline struct intel_gt *__uc_fw_to_gt(struct intel_uc_fw *uc_fw) static inline struct intel_gt *
____uc_fw_to_gt(struct intel_uc_fw *uc_fw, enum intel_uc_fw_type type)
{ {
GEM_BUG_ON(uc_fw->status == INTEL_UC_FIRMWARE_UNINITIALIZED); if (type == INTEL_UC_FW_TYPE_GUC)
if (uc_fw->type == INTEL_UC_FW_TYPE_GUC)
return container_of(uc_fw, struct intel_gt, uc.guc.fw); return container_of(uc_fw, struct intel_gt, uc.guc.fw);
GEM_BUG_ON(uc_fw->type != INTEL_UC_FW_TYPE_HUC); GEM_BUG_ON(type != INTEL_UC_FW_TYPE_HUC);
return container_of(uc_fw, struct intel_gt, uc.huc.fw); return container_of(uc_fw, struct intel_gt, uc.huc.fw);
} }
static inline struct intel_gt *__uc_fw_to_gt(struct intel_uc_fw *uc_fw)
{
GEM_BUG_ON(uc_fw->status == INTEL_UC_FIRMWARE_UNINITIALIZED);
return ____uc_fw_to_gt(uc_fw, uc_fw->type);
}
#ifdef CONFIG_DRM_I915_DEBUG_GUC #ifdef CONFIG_DRM_I915_DEBUG_GUC
void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw, void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw,
enum intel_uc_fw_status status) enum intel_uc_fw_status status)
...@@ -195,9 +201,10 @@ static void __uc_fw_user_override(struct intel_uc_fw *uc_fw) ...@@ -195,9 +201,10 @@ static void __uc_fw_user_override(struct intel_uc_fw *uc_fw)
* firmware to fetch and load. * firmware to fetch and load.
*/ */
void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
enum intel_uc_fw_type type, bool supported, enum intel_uc_fw_type type)
enum intel_platform platform, u8 rev)
{ {
struct drm_i915_private *i915 = ____uc_fw_to_gt(uc_fw, type)->i915;
/* /*
* we use FIRMWARE_UNINITIALIZED to detect checks against uc_fw->status * we use FIRMWARE_UNINITIALIZED to detect checks against uc_fw->status
* before we're looked at the HW caps to see if we have uc support * before we're looked at the HW caps to see if we have uc support
...@@ -208,8 +215,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, ...@@ -208,8 +215,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
uc_fw->type = type; uc_fw->type = type;
if (supported) { if (HAS_GT_UC(i915)) {
__uc_fw_auto_select(uc_fw, platform, rev); __uc_fw_auto_select(uc_fw,
INTEL_INFO(i915)->platform,
INTEL_REVID(i915));
__uc_fw_user_override(uc_fw); __uc_fw_user_override(uc_fw);
} }
......
...@@ -239,8 +239,7 @@ static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw) ...@@ -239,8 +239,7 @@ static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
} }
void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
enum intel_uc_fw_type type, bool supported, enum intel_uc_fw_type type);
enum intel_platform platform, u8 rev);
int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw); int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw);
void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw); void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw);
int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 offset, u32 dma_flags); int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 offset, u32 dma_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment