HuC Loading Patches
Subsystems (3)
cover HuC Loading Patches
These patches add HuC loading support. The driver builds a frame level workload which is stored in the graphics memory. This workload is presented to HuC for processing. The driver, therefore should first determine if the HuC is enabled and also read the huC athentication status bit to determine if HuC was successfully loaded. The GuC is required to authenticate the HuC. The userspace patches that check for a fully loaded HuC firmware and use it can be found at:
https://lists.freedesktop.org/archives/libva/2016-September/004554.html
https://lists.freedesktop.org/archives/libva/2016-September/004555.html
More information regarding the HuC, batch commands that configure the HuC etc can be found at-
https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol02a-commandreference-instructions-huc.pdf
https://www.x.org/docs/intel/CHV/intel-gfx-prm-osrc-chv-bsw-vol10-hevc.pdf
v2: rebased.
v3: rebased. Changed the code following the review comments.
v4: Added action_lock initialization fix provided by Arek
(Hiler Arkadiusz) to the first patch in the series- Make the
GuC fw loading helper functions general.
v5: rebased on top of drm-tip. The patch series is now in sync with GuC code reorganization efforts by Arek-
https://patchwork.freedesktop.org/series/15896/
v6:rebased. Organize code. Move contents of intel_huc.h to intel_uc.h. Update function intel_huc_load(),intel_huc_init() and intel_uc_fw_fetch() to accept dev_priv instead of dev.
v7: rebased. Remove intel_is_huc_valid() since it is called onoly once. Refactor the code to reduce redundency. Remove fiels like uc_dev which are no longer used.
v8: rebased. Beautify the code- remove comments that no longer hold good, add newlines etc.
v9: rebased. Remove further redundency. Correct comments. Replace wait_for with intel_wait_for_register() for optimisation purpose.Make fw_type an enum.
Anusha Srivatsa (3):
drm/i915/huc: Add HuC fw loading support
drm/i915/huc: Add BXT HuC Loading Support
drm/i915/HuC: Add KBL huC loading Support
Peter Antoine (5):
drm/i915/guc: Make the GuC fw loading helper functions general drm/i915/huc: Unified css_header struct for GuC and HuC drm/i915/huc: Add debugfs for HuC loading status check drm/i915/huc: Support HuC authentication drm/i915/get_params: Add HuC status to getparams
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_debugfs.c | 43 ++++- drivers/gpu/drm/i915/i915_drv.c | 11 +- drivers/gpu/drm/i915/i915_drv.h | 3 +- drivers/gpu/drm/i915/i915_guc_reg.h | 3 + drivers/gpu/drm/i915/i915_guc_submission.c | 4 +- drivers/gpu/drm/i915/intel_guc_fwif.h | 24 ++- drivers/gpu/drm/i915/intel_guc_loader.c | 200 ++++++++++---------- drivers/gpu/drm/i915/intel_huc_loader.c | 283 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_uc.c | 68 ++++++- drivers/gpu/drm/i915/intel_uc.h | 64 +++++-- include/uapi/drm/i915_drm.h | 1 + 12 files changed, 579 insertions(+), 126 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/8 drm/i915/guc: Make the GuC fw loading helper functions general
From: Peter Antoine <[email protected]>
Rename some of the GuC fw loading code to make them more general. We will utilise them for HuC loading as well.
s/intel_guc_fw/intel_uc_fw/g s/GUC_FIRMWARE/UC_FIRMWARE/g
Struct intel_guc_fw is renamed to intel_uc_fw. Prefix of tts members, such as 'guc' or 'guc_fw' either is renamed to 'uc' or removed for same purpose.
v2: rebased on top of nightly.
reapplied the search/replace as upstream code as changed.
v3: rebased again on drm-nightly.
v4: removed G from messages in shared fw fetch function.
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased.Updated dev to dev_priv in intel_guc_setup(), guc_fw_getch() and intel_guc_init().
v14: rebased. Remove uint32_t fw_type to patch 2. Add INTEL_ prefix for fields in enum intel_uc_fw_status. Remove uc_dev field since its never used.Rename uc_fw to just fw and guc_fw to fw to avoid redundency.
v15: rebased. Remove sections of code that were commented and no longer required.
v16: rebased. Remove uc_fw_ prefix from path and obj fields in intel_uc_fw struct as suggested by Michal.
--- drivers/gpu/drm/i915/i915_debugfs.c | 12 +-- drivers/gpu/drm/i915/i915_guc_submission.c | 4 +- drivers/gpu/drm/i915/intel_guc_loader.c | 156 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_uc.h | 36 +++---- 4 files changed, 104 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +6 -6
@@ -2328,7 +2328,7 @@ static int i915_llc(struct seq_file *m, void *data)static int i915_guc_load_status_info (struct seq_file *m,void *data) {struct drm_i915_private *dev_priv =node_to_i915 (m->private); -struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw; +struct intel_uc_fw *guc_fw = &dev_priv->guc.fw;u32 tmp, i;if (!HAS_GUC_UCODE (dev_priv))
@@ -2336,15 +2336,15 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)seq_printf (m,"GuC firmware status:\n" );seq_printf (m,"\tpath: %s\n" , - guc_fw->guc_fw_path); + guc_fw->path);seq_printf (m,"\tfetch: %s\n" , -intel_guc_fw_status_repr (guc_fw->guc_fw_fetch_status)); +intel_uc_fw_status_repr (guc_fw->fetch_status));seq_printf (m,"\tload: %s\n" , -intel_guc_fw_status_repr (guc_fw->guc_fw_load_status)); +intel_uc_fw_status_repr (guc_fw->load_status));seq_printf (m,"\tversion wanted: %d.%d\n" , - guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted); + guc_fw->major_ver_wanted, guc_fw->minor_ver_wanted);seq_printf (m,"\tversion found: %d.%d\n" , - guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found); + guc_fw->major_ver_found, guc_fw->minor_ver_found);seq_printf (m,"\theader: offset is %d; size = %d\n" , guc_fw->header_offset, guc_fw->header_size); seq_printf(m, "\tuCode: offset is %d; size = %d\n",
drivers/gpu/drm/i915/i915_guc_submission.c +2 -2
@@ -1484,7 +1484,7 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv)struct i915_gem_context *ctx;u32 data[3 ]; -if (guc->guc_fw.guc_fw_load_status !=GUC_FIRMWARE_SUCCESS ) +if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS )return 0 ;gen9_disable_guc_interrupts (dev_priv);
@@ -1511,7 +1511,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)struct i915_gem_context *ctx;u32 data[3 ]; -if (guc->guc_fw.guc_fw_load_status !=GUC_FIRMWARE_SUCCESS ) +if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS )return 0 ;if (i915.guc_log_level >=0 )
drivers/gpu/drm/i915/intel_guc_loader.c +78 -78
341 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +18 -18
@@ -93,28 +93,28 @@ struct i915_guc_client {uint64_t submissions[I915_NUM_ENGINES ]; }; -enum intel_guc_fw_status { -GUC_FIRMWARE_FAIL =-1 , -GUC_FIRMWARE_NONE =0 , -GUC_FIRMWARE_PENDING , -GUC_FIRMWARE_SUCCESS +enum intel_uc_fw_status { +INTEL_UC_FIRMWARE_FAIL =-1 , +INTEL_UC_FIRMWARE_NONE =0 , +INTEL_UC_FIRMWARE_PENDING , +INTEL_UC_FIRMWARE_SUCCESS };/* * This structure encapsulates all the data needed during the process * of fetching, caching, and loading the firmware image into the GuC. */ -struct intel_guc_fw { -const char * guc_fw_path; -size_t guc_fw_size; -struct drm_i915_gem_object * guc_fw_obj; -enum intel_guc_fw_status guc_fw_fetch_status; -enum intel_guc_fw_status guc_fw_load_status; - -uint16_t guc_fw_major_wanted; -uint16_t guc_fw_minor_wanted; -uint16_t guc_fw_major_found; -uint16_t guc_fw_minor_found; +struct intel_uc_fw { +const char *path; +size_t size; +struct drm_i915_gem_object *obj; +enum intel_uc_fw_status fetch_status; +enum intel_uc_fw_status load_status; + +uint16_t major_ver_wanted; +uint16_t minor_ver_wanted; +uint16_t major_ver_found; +uint16_t minor_ver_found;uint32_t header_size;uint32_t header_offset;
@@ -141,7 +141,7 @@ struct intel_guc_log { };struct intel_guc { -struct intel_guc_fw guc_fw; +struct intel_uc_fw fw;struct intel_guc_log log;/* intel_guc_recv interrupt related state */
@@ -182,7 +182,7 @@ int intel_guc_log_control(struct intel_guc *guc, u32 control_val);extern void intel_guc_init (struct drm_i915_private *dev_priv);extern int intel_guc_setup (struct drm_i915_private *dev_priv);extern void intel_guc_fini (struct drm_i915_private *dev_priv); -extern const char *intel_guc_fw_status_repr (enum intel_guc_fw_status status); +extern const char *intel_uc_fw_status_repr (enum intel_uc_fw_status status);extern int intel_guc_suspend (struct drm_i915_private *dev_priv);extern int intel_guc_resume (struct drm_i915_private *dev_priv);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/8] drm/i915/guc: Make the GuC fw loading helper functions general
Quoted 32 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
Rename some of the GuC fw loading code to make them more general. We will utilise them for HuC loading as well.
s/intel_guc_fw/intel_uc_fw/g s/GUC_FIRMWARE/UC_FIRMWARE/gStruct
intel_guc_fwis renamed tointel_uc_fw. Prefix of tts members, such as 'guc' or 'guc_fw' either is renamed to 'uc' or removed for same purpose.v2: rebased on top of nightly.
reapplied the search/replace as upstream code as changed.
v3: rebased again on drm-nightly.
v4: removed G from messages in shared fw fetch function.
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased.Updated dev todev_privinintel_guc_setup(),guc_fw_getch()andintel_guc_init().
v14: rebased. Removeuint32_tfw_typeto patch 2. AddINTEL_prefix for fields in enumintel_uc_fw_status. Removeuc_devfield since its never used.Renameuc_fwto just fw andguc_fwto fw to avoid redundency.
v15: rebased. Remove sections of code that were commented and no longer required.
v16: rebased. Removeuc_fw_prefix from path and obj fields inintel_uc_fwstruct as suggested by Michal.
Quoted 5 lines
Cc Michal Wajdeczko <[email protected]>Cc Arkadiusz Hiler <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/i915/i915_debugfs.c | 12 +-- drivers/gpu/drm/i915/i915_guc_submission.c | 4 +- drivers/gpu/drm/i915/intel_guc_loader.c | 156 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_uc.h | 36 +++---- 4 files changed, 104 insertions(+), 104 deletions(-)
Signature · 6 lines
Cheers, Arek _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/8 drm/i915/huc: Unified css_header struct for GuC and HuC
In reply to Anusha SrivatsaFrom: Peter Antoine <[email protected]>
HuC firmware css header has almost exactly same definition as GuC firmware except for the sw_version. Also, add a new member fw_type into intel_uc_fw to indicate what kind of fw it is. So, the loader will pull right sw_version from header.
v2: rebased on-top of drm-intel-nightly
v3: rebased on-top of drm-intel-nightly (again).
v4: rebased + spaces.
v7: rebased.
v8: rebased.
v9: rebased. Rename device_id to guc_branch_client_version, make guc_sw_version a union. <Jeff Mcgee>. Put UC_FW_TYPE_GUC and UC_FW_TYPE_HUC into an enum.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip.
v13: rebased.Update dev to dev_priv in intel_uc_fw_fetch
v14: rebased. Add INTEL_ prefix to an enum. Add fw_type declaration from patch 1.Combine two different unions for huc and guc version, reserved etc into one union with two structs.
v15: rebased.
v16: rebased. Change fw_type to enum.
--- drivers/gpu/drm/i915/intel_guc_fwif.h | 23 ++++++++++++++---- drivers/gpu/drm/i915/intel_guc_loader.c | 41 ++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_uc.h | 6 +++++ 3 files changed, 53 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_guc_fwif.h +19 -4
@@ -145,7 +145,7 @@* The GuC firmware layout looks like this: * * +-------------------------------+ -* | guc_css_header | +* | uc_css_header | * | | * | contains major/minor version | * +-------------------------------+
@@ -172,9 +172,16 @@* 3. Length info of each component can be found in header, in dwords. * 4. Modulus and exponent key are not required by driver. They may not appear * in fw. So driver will load a truncated firmware in this case. +* +* HuC firmware layout is same as GuC firmware. +* +* HuC firmware css header is different. However, the only difference is where +* the version information is saved. The uc_css_header is unified to support +* both. Driver should get HuC version from uc_css_header.huc_sw_version, while +* uc_css_header.guc_sw_version for GuC. */ -struct guc_css_header { +struct uc_css_header {uint32_t module_type;/* header_size includes all non-uCode bits, including css_header, rsa * key, modulus key and exponent data. */
@@ -205,8 +212,16 @@ struct guc_css_header {char username[8 ];char buildnumber[12 ]; -uint32_t device_id; -uint32_t guc_sw_version; +union { +struct { +uint32_t branch_client_version; +uint32_t sw_version; + } guc; +struct { +uint32_t sw_version; +uint32_t reserved; + } huc; + };uint32_t prod_preprod_fw;uint32_t reserved[12 ];uint32_t header_info;
drivers/gpu/drm/i915/intel_guc_loader.c +28 -13
75 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +6 -0
@@ -100,6 +100,11 @@ enum intel_uc_fw_status { INTEL_UC_FIRMWARE_SUCCESS }; +enum fw_type { +INTEL_UC_FW_TYPE_GUC , +INTEL_UC_FW_TYPE_HUC +}; +/* * This structure encapsulates all the data needed during the process * of fetching, caching, and loading the firmware image into the GuC.
@@ -116,6 +121,7 @@ struct intel_uc_fw {uint16_t major_ver_found;uint16_t minor_ver_found; +enum fw_type fw;uint32_t header_size;uint32_t header_offset;uint32_t rsa_size;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/8] drm/i915/huc: Unified css_header struct for GuC and HuC
Quoted 172 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
HuC firmware css header has almost exactly same definition as GuC firmware except for the
sw_version. Also, add a new memberfw_typeintointel_uc_fwto indicate what kind of fw it is. So, the loader will pull rightsw_versionfrom header.v2: rebased on-top of drm-intel-nightly
v3: rebased on-top of drm-intel-nightly (again).
v4: rebased + spaces.
v7: rebased.
v8: rebased.
v9: rebased. Renamedevice_idtoguc_branch_client_version, makeguc_sw_versiona union. <Jeff Mcgee>. PutUC_FW_TYPE_GUCandUC_FW_TYPE_HUCinto an enum.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip.
v13: rebased.Update dev todev_privinintel_uc_fw_fetch
v14: rebased. AddINTEL_prefix to an enum. Addfw_typedeclaration from patch 1.Combine two different unions for huc and guc version, reserved etc into one union with two structs.
v15: rebased.
v16: rebased. Changefw_typeto enum.Tested-by Xiang Haihao <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/intel_guc_fwif.h | 23 ++++++++++++++---- drivers/gpu/drm/i915/intel_guc_loader.c | 41 ++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_uc.h | 6 +++++ 3 files changed, 53 insertions(+), 17 deletions(-)drivers/gpu/drm/i915/intel_guc_fwif.h +19
-4@@ -145,7 +145,7 @@* The GuC firmware layout looks like this: * * +-------------------------------+ -* | guc_css_header | +* | uc_css_header | * | | * | contains major/minor version | * +-------------------------------+ @@ -172,9 +172,16 @@* 3. Length info of each component can be found in header, in dwords. * 4. Modulus and exponent key are not required by driver. They may not appear * in fw. So driver will load a truncated firmware in this case. +* +* HuC firmware layout is same as GuC firmware. +* +* HuC firmware css header is different. However, the only difference is where +* the version information is saved. The uc_css_header is unified to support +* both. Driver should get HuC version from uc_css_header.huc_sw_version, while +* uc_css_header.guc_sw_version for GuC. */ -struct guc_css_header { +struct uc_css_header {uint32_t module_type;/* header_size includes all non-uCode bits, including css_header, rsa * key, modulus key and exponent data. */ @@ -205,8 +212,16 @@ struct guc_css_header {char username[8 ];char buildnumber[12 ]; -uint32_t device_id; -uint32_t guc_sw_version; +union { +struct { +uint32_t branch_client_version; +uint32_t sw_version; + } guc; +struct { +uint32_t sw_version; +uint32_t reserved; + } huc; + };uint32_t prod_preprod_fw;uint32_t reserved[12 ];uint32_t header_info;drivers/gpu/drm/i915/intel_guc_loader.c +28
-13@@ -593,7 +593,7 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,struct pci_dev *pdev = dev_priv->drm.pdev;struct drm_i915_gem_object *obj;const struct firmware *fw =NULL ; -struct guc_css_header *css; +struct uc_css_header *css;size_t size;int err;@@ -610,19 +610,19 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, uc_fw->path, fw);/* Check the size of the blob before examining buffer contents */ -if (fw->size <sizeof (struct guc_css_header )) { +if (fw->size <sizeof (struct uc_css_header )) {DRM_NOTE ("Firmware header is missing\n" ); goto fail; } - css = (struct guc_css_header *)fw->data; + css = (struct uc_css_header *)fw->data;/* Firmware bits always start from header */ uc_fw->header_offset =0 ; uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw - css->key_size_dw - css->exponent_size_dw) *sizeof (u32); -if (uc_fw->header_size !=sizeof (struct guc_css_header )) { +if (uc_fw->header_size !=sizeof (struct uc_css_header )) {DRM_NOTE ("CSS header definition mismatch\n" ); goto fail; }@@ -646,21 +646,36 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, goto fail; } -/* Header and uCode will be loaded to WOPCM. Size of the two. */ - size = uc_fw->header_size + uc_fw->ucode_size; -if (size >guc_wopcm_size (dev_priv)) { -DRM_NOTE ("Firmware is too large to fit in WOPCM\n" ); - goto fail; - } -/* * The GuC firmware image has the version number embedded at a well-known * offset within the firmware blob; note that major / minor version are * TWO bytes each (i.e. u16), although all pointers and offsets are defined * in terms of bytes (u8). */ - uc_fw->major_ver_found = css->guc_sw_version >>16 ; - uc_fw->minor_ver_found = css->guc_sw_version &0xFFFF ; +switch (uc_fw->fw) { +case INTEL_UC_FW_TYPE_GUC : +/* Header and uCode will be loaded to WOPCM. Size of the two. */ + size = uc_fw->header_size + uc_fw->ucode_size; + +/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */ +if (size >guc_wopcm_size (dev_priv)) { +DRM_ERROR ("Firmware is too large to fit in WOPCM\n" ); + goto fail; + } + uc_fw->major_ver_found = css->guc.sw_version >>16 ; + uc_fw->minor_ver_found = css->guc.sw_version &0xFFFF ; +break ; + +case INTEL_UC_FW_TYPE_HUC : + uc_fw->major_ver_found = css->huc.sw_version >>16 ; + uc_fw->minor_ver_found = css->huc.sw_version &0xFFFF ; +break ; + +default : +DRM_ERROR ("Unknown firmware type %d\n" , uc_fw->fw); + err = -ENOEXEC ; + goto fail; + }if (uc_fw->major_ver_found != uc_fw->major_ver_wanted || uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {drivers/gpu/drm/i915/intel_uc.h +0
-0
drivers/gpu/drm/i915/intel_uc.h enum intel_uc_fw_status { · line 103
Quoted 4 lines
drivers/gpu/drm/i915/intel_uc.h +1
-0@@ -100,6 +100,11 @@ enum intel_uc_fw_status {INTEL_UC_FIRMWARE_SUCCESS }; +enum fw_type {
WARNING: missing space after enum definition
#180: FILE: drivers/gpu/drm/i915/intel_uc.h:103:
with the space fixed
Quoted 22 lines
drivers/gpu/drm/i915/intel_uc.h +5
-0+INTEL_UC_FW_TYPE_GUC , + INTEL_UC_FW_TYPE_HUC +}; +/* * This structure encapsulates all the data needed during the process * of fetching, caching, and loading the firmware image into the GuC. @@ -116,6 +121,7 @@ struct intel_uc_fw {uint16_t major_ver_found;uint16_t minor_ver_found; +enum fw_type fw;uint32_t header_size;uint32_t header_offset;uint32_t rsa_size;Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Cheers, Arek _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/8 drm/i915/huc: Add HuC fw loading support
In reply to Anusha SrivatsaThe HuC loading process is similar to GuC. The intel_uc_fw_fetch() is used for both cases.
HuC loading needs to be before GuC loading. The WOPCM setting must be done early before loading any of them.
v2: rebased on-top of drm-intel-nightly.
removed if(HAS_GUC()) before the guc call. (D.Gordon) update huc_version number of format.
v3: rebased to drm-intel-nightly, changed the file name format to
match the one in the huc package.
Changed dev->dev_private to to_i915()
v4: moved function back to where it was.
change wait_for_atomic to wait_for.
v5: rebased + comment changes.
v7: rebased.
v8: rebased.
v9: rebased. Changed the year in the copyright message to reflect the right year.Correct the comments,remove the unwanted WARN message, replace drm_gem_object_unreference() with i915_gem_object_put().Make the prototypes in intel_huc.h non-extern.
v10: rebased. Update the file construction done by HuC. It is similar to GuC.Adopted the approach used in-
https://patchwork.freedesktop.org/patch/104355/ <Tvrtko Ursulin>
v11: Fix warnings remove old declaration
v12: Change dev to dev_priv in macro definition.
Corrected comments.
v13: rebased.
v14: rebased on top of drm-tip
v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents of intel_huc.h to intel_uc.h
v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size(). Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to simply fw to avoid redundency.
v17: rebased.
v18: rebased. Correct comments.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 4 +- drivers/gpu/drm/i915/i915_drv.h | 3 +- drivers/gpu/drm/i915/i915_guc_reg.h | 3 + drivers/gpu/drm/i915/intel_guc_loader.c | 11 +- drivers/gpu/drm/i915/intel_huc_loader.c | 260 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_uc.h | 19 ++- 7 files changed, 293 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \ # general-purpose microcontroller (GuC) support i915-y += intel_uc.o \ intel_guc_loader.o \ + intel_huc_loader.o \ i915_guc_submission.o # autogenerated null render state
drivers/gpu/drm/i915/i915_drv.c +3 -1
@@ -599,6 +599,7 @@ static int i915_load_modeset_init(struct drm_device *dev)if (ret) goto cleanup_irq; +intel_huc_init (dev_priv);intel_guc_init (dev_priv); ret =i915_gem_init (dev_priv);
@@ -626,6 +627,7 @@ static int i915_load_modeset_init(struct drm_device *dev)DRM_ERROR ("failed to idle hardware; continuing to unload!\n" );i915_gem_fini (dev_priv); cleanup_irq: +intel_huc_fini (dev);intel_guc_fini (dev_priv);drm_irq_uninstall (dev);intel_teardown_gmbus (dev_priv);
@@ -1312,7 +1314,7 @@ void i915_driver_unload(struct drm_device *dev)/* Flush any outstanding unpin_work. */ drain_workqueue (dev_priv->wq); - +intel_huc_fini (dev);intel_guc_fini (dev_priv);i915_gem_fini (dev_priv);intel_fbc_cleanup_cfb (dev_priv);
drivers/gpu/drm/i915/i915_drv.h +2 -1
@@ -2080,6 +2080,7 @@ struct drm_i915_private {struct intel_gvt *gvt; +struct intel_huc huc;struct intel_guc guc;struct intel_csr csr;
@@ -2854,7 +2855,7 @@ intel_info(const struct drm_i915_private *dev_priv)#define HAS_GUC (dev_priv) ((dev_priv)->info.has_guc)#define HAS_GUC_UCODE (dev_priv) (HAS_GUC(dev_priv))#define HAS_GUC_SCHED (dev_priv) (HAS_GUC(dev_priv)) - +#define HAS_HUC_UCODE (dev_priv) (HAS_GUC(dev_priv))#define HAS_RESOURCE_STREAMER (dev_priv) ((dev_priv)->info.has_resource_streamer)#define HAS_POOLED_EU (dev_priv) ((dev_priv)->info.has_pooled_eu)
drivers/gpu/drm/i915/i915_guc_reg.h +3 -0
@@ -61,9 +61,12 @@#define DMA_ADDRESS_SPACE_GTT (8 << 16)#define DMA_COPY_SIZE _MMIO(0xc310)#define DMA_CTRL _MMIO(0xc314) +#define HUC_UKERNEL (1<<9)#define UOS_MOVE (1<<4)#define START_DMA (1<<0)#define DMA_GUC_WOPCM_OFFSET _MMIO(0xc340) +#define HUC_LOADING_AGENT_VCR (0<<1) +#define HUC_LOADING_AGENT_GUC (1<<1)#define GUC_WOPCM_OFFSET_VALUE 0x80000/* 512KB */ #define GUC_MAX_IDLE_COUNT _MMIO(0xC3E4)
drivers/gpu/drm/i915/intel_guc_loader.c +6 -5
@@ -309,8 +309,8 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,I915_WRITE (DMA_ADDR_1_HIGH ,DMA_ADDRESS_SPACE_WOPCM );/* Finally start the DMA */ -I915_WRITE (DMA_CTRL ,_MASKED_BIT_ENABLE (UOS_MOVE |START_DMA )); - +I915_WRITE (DMA_CTRL ,_MASKED_BIT_ENABLE (UOS_MOVE |START_DMA ) | +_MASKED_BIT_DISABLE (HUC_UKERNEL ));/* * Wait for the DMA to complete & the GuC to start up. * NB: Docs recommend not using the interrupt for completion.
@@ -334,7 +334,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,return ret; } -static u32 guc_wopcm_size (struct drm_i915_private *dev_priv) +u32 intel_guc_wopcm_size (struct drm_i915_private *dev_priv) {u32 wopcm_size =GUC_WOPCM_TOP ;
@@ -372,7 +372,7 @@ static int guc_ucode_xfer(struct drm_i915_private *dev_priv)intel_uncore_forcewake_get (dev_priv,FORCEWAKE_ALL );/* init WOPCM */ -I915_WRITE (GUC_WOPCM_SIZE ,guc_wopcm_size (dev_priv)); +I915_WRITE (GUC_WOPCM_SIZE ,intel_guc_wopcm_size (dev_priv));I915_WRITE (DMA_GUC_WOPCM_OFFSET ,GUC_WOPCM_OFFSET_VALUE );/* Enable MIA caching. GuC clock gating is disabled. */
@@ -511,6 +511,7 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)if (err) goto fail; +intel_huc_load (dev_priv); err =guc_ucode_xfer (dev_priv);if (!err)break ;
@@ -658,7 +659,7 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, size = uc_fw->header_size + uc_fw->ucode_size;/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */ -if (size >guc_wopcm_size (dev_priv)) { +if (size >intel_guc_wopcm_size (dev_priv)) {DRM_ERROR ("Firmware is too large to fit in WOPCM\n" ); goto fail; }
drivers/gpu/drm/i915/intel_huc_loader.c new file +260 -0
260 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +18 -1
@@ -24,6 +24,9 @@#ifndef _INTEL_UC_H_#define _INTEL_UC_H_ +#define HUC_STATUS2 _MMIO(0xD3B0) +#define HUC_FW_VERIFIED (1<<7) +#include "intel_guc_fwif.h" #include "i915_guc_reg.h" #include "intel_ringbuffer.h"
@@ -176,6 +179,13 @@ struct intel_guc {struct mutex send_mutex; }; +struct intel_huc { +/* Generic uC firmware management */ +struct intel_uc_fw fw; + +/* HuC-specific additions */ +}; +/* intel_uc.c */ void intel_uc_init_early (struct drm_i915_private *dev_priv);int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len);
@@ -191,6 +201,9 @@ extern void intel_guc_fini(struct drm_i915_private *dev_priv);extern const char *intel_uc_fw_status_repr (enum intel_uc_fw_status status);extern int intel_guc_suspend (struct drm_i915_private *dev_priv);extern int intel_guc_resume (struct drm_i915_private *dev_priv); +void intel_uc_fw_fetch (struct drm_i915_private *dev_priv, +struct intel_uc_fw *uc_fw); +u32 intel_guc_wopcm_size (struct drm_i915_private *dev_priv);/* i915_guc_submission.c */ int i915_guc_submission_init (struct drm_i915_private *dev_priv);
@@ -204,7 +217,6 @@ void i915_guc_flush_logs(struct drm_i915_private *dev_priv);void i915_guc_register (struct drm_i915_private *dev_priv);void i915_guc_unregister (struct drm_i915_private *dev_priv);int i915_guc_log_control (struct drm_i915_private *dev_priv,u64 control_val); -static inline u32 guc_ggtt_offset (struct i915_vma *vma) {u32 offset =i915_ggtt_offset (vma);
@@ -212,4 +224,9 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma) return offset; } +/* intel_huc_loader.c */ +void intel_huc_init (struct drm_i915_private *dev_priv); +void intel_huc_fini (struct drm_device *dev); +int intel_huc_load (struct drm_i915_private *dev_priv); +#endif
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/8 drm/i915/huc: Add BXT HuC Loading Support
In reply to Anusha SrivatsaThis patch adds the HuC Loading for the BXT by using the updated file construction.
Version 1.7 of the HuC firmware.
v2: rebased.
v3: rebased on top of drm-tip
v4: rebased.
v5: rebased. Rename BXT_FW_MAJOR to BXT_HUC_FW_
v6: rebased.
v7: rebased.
--- drivers/gpu/drm/i915/intel_huc_loader.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_huc_loader.c +11 -0
@@ -40,6 +40,10 @@* Note that HuC firmware loading must be done before GuC loading. */ +#define BXT_HUC_FW_MAJOR 01 +#define BXT_HUC_FW_MINOR 07 +#define BXT_BLD_NUM 1398 +#define SKL_HUC_FW_MAJOR 01#define SKL_HUC_FW_MINOR 07#define SKL_BLD_NUM 1398
@@ -52,6 +56,9 @@ SKL_HUC_FW_MINOR, SKL_BLD_NUM)MODULE_FIRMWARE (I915_SKL_HUC_UCODE ); +#define I915_BXT_HUC_UCODE HUC_FW_PATH(bxt, BXT_HUC_FW_MAJOR, \ + BXT_HUC_FW_MINOR, BXT_BLD_NUM) +MODULE_FIRMWARE (I915_BXT_HUC_UCODE );/** * huc_ucode_xfer() - DMA's the firmware * @dev_priv: the drm device
@@ -153,6 +160,10 @@ void intel_huc_init(struct drm_i915_private *dev_priv) fw_path =I915_SKL_HUC_UCODE ; huc_fw->major_ver_wanted =SKL_HUC_FW_MAJOR ; huc_fw->minor_ver_wanted =SKL_HUC_FW_MINOR ; + }else if (IS_BROXTON (dev_priv)) { + fw_path =I915_BXT_HUC_UCODE ; + huc_fw->major_ver_wanted =BXT_HUC_FW_MAJOR ; + huc_fw->minor_ver_wanted =BXT_HUC_FW_MINOR ; } huc_fw->path = fw_path;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/8 drm/i915/HuC: Add KBL huC loading Support
In reply to Anusha SrivatsaThis patch adds the support to load HuC on KBL Version 2.0
v2: rebased.
v3: rebased on top of drm-tip
v4: rebased.
v5: rebased. Rename KBL_FW_ to KBL_HUC_FW_
v6: rebased. Remove old checks.
v7: rebased.
--- drivers/gpu/drm/i915/intel_huc_loader.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_huc_loader.c +13 -0
@@ -48,6 +48,10 @@#define SKL_HUC_FW_MINOR 07#define SKL_BLD_NUM 1398 +#define KBL_HUC_FW_MAJOR 02 +#define KBL_HUC_FW_MINOR 00 +#define KBL_BLD_NUM 1810 +#define HUC_FW_PATH (platform, major, minor, bld_num) \ "i915/" __stringify(platform) "_huc_ver" __stringify(major) "_" \ __stringify(minor) "_" __stringify(bld_num) ".bin"
@@ -59,6 +63,11 @@ MODULE_FIRMWARE(I915_SKL_HUC_UCODE);#define I915_BXT_HUC_UCODE HUC_FW_PATH(bxt, BXT_HUC_FW_MAJOR, \ BXT_HUC_FW_MINOR, BXT_BLD_NUM)MODULE_FIRMWARE (I915_BXT_HUC_UCODE ); + +#define I915_KBL_HUC_UCODE HUC_FW_PATH(kbl, KBL_HUC_FW_MAJOR, \ + KBL_HUC_FW_MINOR, KBL_BLD_NUM) +MODULE_FIRMWARE (I915_KBL_HUC_UCODE ); +/** * huc_ucode_xfer() - DMA's the firmware * @dev_priv: the drm device
@@ -164,6 +173,10 @@ void intel_huc_init(struct drm_i915_private *dev_priv) fw_path =I915_BXT_HUC_UCODE ; huc_fw->major_ver_wanted =BXT_HUC_FW_MAJOR ; huc_fw->minor_ver_wanted =BXT_HUC_FW_MINOR ; + }else if (IS_KABYLAKE (dev_priv)) { + fw_path =I915_KBL_HUC_UCODE ; + huc_fw->major_ver_wanted =KBL_HUC_FW_MAJOR ; + huc_fw->minor_ver_wanted =KBL_HUC_FW_MINOR ; } huc_fw->path = fw_path;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/8 drm/i915/huc: Add debugfs for HuC loading status check
In reply to Anusha SrivatsaFrom: Peter Antoine <[email protected]>
Add debugfs entry for HuC loading status check.
v2: rebase on-top of drm-intel-nightly.
v3: rebased again.
v7: rebased.
v8: rebased.
v9: rebased.
v10: rebased.
v11: rebased on top of drm-tip
v12: rebased.
v13: rebased.
v14: rebased.
--- drivers/gpu/drm/i915/i915_debugfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +31 -0
@@ -2325,6 +2325,36 @@ static int i915_llc(struct seq_file *m, void *data)return 0 ; } +static int i915_huc_load_status_info (struct seq_file *m,void *data) +{ +struct drm_i915_private *dev_priv =node_to_i915 (m->private); +struct intel_uc_fw *huc_fw = &dev_priv->huc.fw; + +if (!HAS_HUC_UCODE (dev_priv)) +return 0 ; + +seq_puts (m,"HuC firmware status:\n" ); +seq_printf (m,"\tpath: %s\n" , huc_fw->path); +seq_printf (m,"\tfetch: %s\n" , +intel_uc_fw_status_repr (huc_fw->fetch_status)); +seq_printf (m,"\tload: %s\n" , +intel_uc_fw_status_repr (huc_fw->load_status)); +seq_printf (m,"\tversion wanted: %d.%d\n" , + huc_fw->major_ver_wanted, huc_fw->minor_ver_wanted); +seq_printf (m,"\tversion found: %d.%d\n" , + huc_fw->major_ver_found, huc_fw->minor_ver_found); +seq_printf (m,"\theader: offset is %d; size = %d\n" , + huc_fw->header_offset, huc_fw->header_size); +seq_printf (m,"\tuCode: offset is %d; size = %d\n" , + huc_fw->ucode_offset, huc_fw->ucode_size); +seq_printf (m,"\tRSA: offset is %d; size = %d\n" , + huc_fw->rsa_offset, huc_fw->rsa_size); + +seq_printf (m,"\nHuC status 0x%08x:\n" ,I915_READ (HUC_STATUS2 )); + +return 0 ; +} +static int i915_guc_load_status_info (struct seq_file *m,void *data) {struct drm_i915_private *dev_priv =node_to_i915 (m->private);
@@ -4553,6 +4583,7 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_guc_info", i915_guc_info, 0}, {"i915_guc_load_status", i915_guc_load_status_info, 0}, {"i915_guc_log_dump", i915_guc_log_dump, 0}, + {"i915_huc_load_status", i915_huc_load_status_info, 0}, {"i915_frequency_info", i915_frequency_info, 0}, {"i915_hangcheck_info", i915_hangcheck_info, 0}, {"i915_drpc_info", i915_drpc_info, 0},
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/8 drm/i915/huc: Support HuC authentication
In reply to Anusha SrivatsaFrom: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changed wait_for_automic to wait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Rename intel_huc_auh() to intel_guc_auth_huc() and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Moved intel_guc_auth_huc from i915_guc_submission.c to intel_uc.c.Update dev to dev_priv in intel_guc_auth_huc(). Renamed HOST2GUC_ACTION_AUTHENTICATE_HUC TO INTEL_GUC_ACTION_ AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline on DRM_ERRORs that already dont have one.
v16: rebased. Replace wait_for with intel_wait_for_register() since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.
--- drivers/gpu/drm/i915/intel_guc_fwif.h | 1 + drivers/gpu/drm/i915/intel_guc_loader.c | 2 + drivers/gpu/drm/i915/intel_uc.c | 70 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 72 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_guc_fwif.h +1 -0
@@ -506,6 +506,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , +INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 , INTEL_GUC_ACTION_LIMIT };
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)intel_uc_fw_status_repr (guc_fw->fetch_status), intel_uc_fw_status_repr(guc_fw->load_status)); +intel_guc_auth_huc (dev_priv); +if (i915.enable_guc_submission) {if (i915.guc_log_level >=0 )gen9_enable_guc_interrupts (dev_priv);
drivers/gpu/drm/i915/intel_uc.c +68 -2
85 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +1 -0
@@ -193,6 +193,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);int intel_guc_log_flush_complete (struct intel_guc *guc);int intel_guc_log_flush (struct intel_guc *guc);int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +void intel_guc_auth_huc (struct drm_i915_private *dev_priv);/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_i915_private *dev_priv);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/8] drm/i915/huc: Support HuC authentication
Quoted 80 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changedwait_for_automictowait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Renameintel_huc_auh()tointel_guc_auth_huc()and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Movedintel_guc_auth_hucfromi915_guc_submission.cto intel_uc.c.Update dev todev_privinintel_guc_auth_huc(). RenamedHOST2GUC_ACTION_AUTHENTICATE_HUCTOINTEL_GUC_ACTION_AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline onDRM_ERRORsthat already dont have one.
v16: rebased. Replacewait_forwithintel_wait_for_register()since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.Cc Chris Wilson <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Michal Wajdeczko <[email protected]>Tested-by Xiang Haihao <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/intel_guc_fwif.h | 1 + drivers/gpu/drm/i915/intel_guc_loader.c | 2 + drivers/gpu/drm/i915/intel_uc.c | 70 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 72 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_guc_fwif.h +1
-0@@ -506,6 +506,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , +INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 , INTEL_GUC_ACTION_LIMIT };drivers/gpu/drm/i915/intel_guc_loader.c +2
-0@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)intel_uc_fw_status_repr (guc_fw->fetch_status), intel_uc_fw_status_repr(guc_fw->load_status)); +intel_guc_auth_huc (dev_priv); +if (i915.enable_guc_submission) {if (i915.guc_log_level >=0 )gen9_enable_guc_interrupts (dev_priv);drivers/gpu/drm/i915/intel_uc.c +1
-1@@ -46,7 +46,7 @@ static bool intel_guc_recv(struct intel_guc *guc, u32 *status)int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len) {struct drm_i915_private *dev_priv =guc_to_i915 (guc); -u32 status; +u32 status =0 ;int i;int ret;
drivers/gpu/drm/i915/intel_uc.c int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len) · line 78
Quoted 9 lines
drivers/gpu/drm/i915/intel_uc.c +5
-1@@ -71,7 +71,11 @@ int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len)* up to that length of time, then switch to a slower sleep-wait loop. * No inte_guc_send command should ever take longer than 10ms. */ - ret =wait_for_us (intel_guc_recv (guc, &status),10 ); + ret =intel_wait_for_register (dev_priv, +HUC_STATUS2 , +HUC_FW_VERIFIED , +HUC_FW_VERIFIED , +50 );
Why do all suddenly intel_guc_send() starts caring about HUC?
I think you've misplaced the check, missed that you were in the wrong place and "fixed" status not being set properly by initializing it with the 0.
Quoted 51 lines
drivers/gpu/drm/i915/intel_uc.c +44
-0if (ret) ret =wait_for (intel_guc_recv (guc, &status),10 );if (status !=INTEL_GUC_STATUS_SUCCESS ) {@@ -140,3 +144,65 @@ int intel_guc_log_control(struct intel_guc *guc, u32 control_val)return intel_guc_send (guc, action,ARRAY_SIZE (action)); } + +/** +* intel_guc_auth_huc() - authenticate ucode +* @dev_priv: the drm_i915_device +* +* Triggers a HuC fw authentication request to the GuC via intel_guc_action_ +* authenticate_huc interface. +* interface. +*/ +void intel_guc_auth_huc (struct drm_i915_private *dev_priv) +{ +struct intel_guc *guc = &dev_priv->guc; +struct intel_huc *huc = &dev_priv->huc; +struct i915_vma *vma; +int ret; +u32 data[2 ]; + +/* Bypass the case where there is no HuC firmware */ +if (huc->fw.fetch_status ==INTEL_UC_FIRMWARE_NONE || + huc->fw.load_status ==INTEL_UC_FIRMWARE_NONE ) +return ; + +if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS ) { +DRM_ERROR ("HuC: GuC fw wasn't loaded. Can't authenticate\n" ); +return ; + } + +if (huc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS ) { +DRM_ERROR ("HuC: fw wasn't loaded. Nothing to authenticate\n" ); +return ; + } + + vma =i915_gem_object_ggtt_pin (huc->fw.obj,NULL ,0 ,0 ,0 ); +if (IS_ERR (vma)) { +DRM_DEBUG_DRIVER ("pin failed %d\n" , (int )PTR_ERR (vma)); +return ; + } + + +/* Invalidate GuC TLB to let GuC take the latest updates to GTT. */ +I915_WRITE (GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); + +/* Specify auth action and where public signature is. */ + data[0 ] =INTEL_GUC_ACTION_AUTHENTICATE_HUC ;
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 200
Quoted 10 lines
drivers/gpu/drm/i915/intel_uc.c +10
-0+ data[1 ] =i915_ggtt_offset (vma) + huc->fw.rsa_offset; + + ret =intel_guc_send (guc, data,ARRAY_SIZE (data)); +if (ret) { +DRM_ERROR ("HuC: GuC did not ack Auth request\n" ); + goto out; + } + +/* Check authentication status, it should be done by now */ + ret =wait_for ((I915_READ (HUC_STATUS2 ) &HUC_FW_VERIFIED ) >0 ,50 );
That's probably the wait_for() you intended to change.
Quoted 23 lines
drivers/gpu/drm/i915/intel_uc.c +8
-0+if (ret) { +DRM_ERROR ("HuC: Authentication failed\n" ); + goto out; + } + +out: +i915_vma_unpin (vma); +}drivers/gpu/drm/i915/intel_uc.h +1
-0@@ -193,6 +193,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);int intel_guc_log_flush_complete (struct intel_guc *guc);int intel_guc_log_flush (struct intel_guc *guc);int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +void intel_guc_auth_huc (struct drm_i915_private *dev_priv);/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_i915_private *dev_priv);Signature · 1 line
2.7.4
Signature · 6 lines
Cheers, Arek _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/8] drm/i915/huc: Support HuC authentication
In reply to Anusha SrivatsaQuoted 27 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changedwait_for_automictowait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Renameintel_huc_auh()tointel_guc_auth_huc()and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Movedintel_guc_auth_hucfromi915_guc_submission.cto intel_uc.c.Update dev todev_privinintel_guc_auth_huc(). RenamedHOST2GUC_ACTION_AUTHENTICATE_HUCTOINTEL_GUC_ACTION_AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline onDRM_ERRORsthat already dont have one.
v16: rebased. Replacewait_forwithintel_wait_for_register()since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.
Quoted 3 lines
Cc Chris Wilson <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Michal Wajdeczko <[email protected]>
Typo in Michal's address.
Quoted 4 lines
Tested-by Xiang Haihao <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>
Signature · 6 lines
Cheers, Arek _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915/huc: Support HuC authentication
From: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changed wait_for_automic to wait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Rename intel_huc_auh() to intel_guc_auth_huc() and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Moved intel_guc_auth_huc from i915_guc_submission.c to intel_uc.c.Update dev to dev_priv in intel_guc_auth_huc(). Renamed HOST2GUC_ACTION_AUTHENTICATE_HUC TO INTEL_GUC_ACTION_ AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline on DRM_ERRORs that already dont have one.
v16: rebased. Replace wait_for with intel_wait_for_register() since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.
v17: rebased. Cleanup the intel_guc_auth_huc() by removing checks already performed in earlier functions. Make comments more descriptive.
--- drivers/gpu/drm/i915/intel_guc_fwif.h | 1 + drivers/gpu/drm/i915/intel_guc_loader.c | 2 ++ drivers/gpu/drm/i915/intel_uc.c | 56 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 59 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_guc_fwif.h +1 -0
@@ -505,6 +505,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENTER_S_STATE =0x501 ,INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , +INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , INTEL_GUC_ACTION_LIMIT };
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)intel_uc_fw_status_repr (guc_fw->fetch_status), intel_uc_fw_status_repr(guc_fw->load_status)); +intel_guc_auth_huc (dev_priv); +if (i915.enable_guc_submission) {if (i915.guc_log_level >=0 )gen9_enable_guc_interrupts (dev_priv);
drivers/gpu/drm/i915/intel_uc.c +55 -1
65 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +1 -0
@@ -190,6 +190,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);int intel_guc_log_flush_complete (struct intel_guc *guc);int intel_guc_log_flush (struct intel_guc *guc);int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +void intel_guc_auth_huc (struct drm_i915_private *dev_priv);/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_i915_private *dev_priv);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/huc: Support HuC authentication
Quoted 29 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changedwait_for_automictowait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Renameintel_huc_auh()tointel_guc_auth_huc()and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Movedintel_guc_auth_hucfromi915_guc_submission.cto intel_uc.c.Update dev todev_privinintel_guc_auth_huc(). RenamedHOST2GUC_ACTION_AUTHENTICATE_HUCTOINTEL_GUC_ACTION_AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline onDRM_ERRORsthat already dont have one.
v16: rebased. Replacewait_forwithintel_wait_for_register()since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.
v17: rebased. Cleanup theintel_guc_auth_huc()by removing checks already performed in earlier functions. Make comments more descriptive.
Quoted 3 lines
Cc Chris Wilson <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Michal Wajdeczko <[email protected]>
There is still typo in my email ;(
Quoted 41 lines
Tested-by Xiang Haihao <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/intel_guc_fwif.h | 1 + drivers/gpu/drm/i915/intel_guc_loader.c | 2 ++ drivers/gpu/drm/i915/intel_uc.c | 56 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 59 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_guc_fwif.h +1
-0@@ -505,6 +505,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENTER_S_STATE =0x501 ,INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , +INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , INTEL_GUC_ACTION_LIMIT };drivers/gpu/drm/i915/intel_guc_loader.c +2
-0@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)intel_uc_fw_status_repr (guc_fw->fetch_status), intel_uc_fw_status_repr(guc_fw->load_status)); +intel_guc_auth_huc (dev_priv); +if (i915.enable_guc_submission) {if (i915.guc_log_level >=0 )gen9_enable_guc_interrupts (dev_priv);drivers/gpu/drm/i915/intel_uc.c +0
-0
drivers/gpu/drm/i915/intel_uc.c static bool intel_guc_recv(struct intel_guc *guc, u32 *status) · line 49
Quoted 5 lines
drivers/gpu/drm/i915/intel_uc.c +1
-1@@ -46,7 +46,7 @@ static bool intel_guc_recv(struct intel_guc *guc, u32 *status)int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len) {struct drm_i915_private *dev_priv =guc_to_i915 (guc); -u32 status; +u32 status =0 ;
Any reason why this chunk is included in the Huc patch ? Merge error ?
Quoted 22 lines
drivers/gpu/drm/i915/intel_uc.c +15
-0int i;int ret;@@ -140,3 +140,57 @@ int intel_guc_log_control(struct intel_guc *guc, u32 control_val)return intel_guc_send (guc, action,ARRAY_SIZE (action)); } + +/** +* intel_guc_auth_huc() - authenticate ucode +* @dev_priv: the drm_i915_device +* +* Triggers a HuC fw authentication request to the GuC via intel_guc_action_ +* authenticate_huc interface. +* interface. +*/ +void intel_guc_auth_huc (struct drm_i915_private *dev_priv) +{ +struct intel_guc *guc = &dev_priv->guc; +struct intel_huc *huc = &dev_priv->huc; +struct i915_vma *vma; +int ret;
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 167
Quoted 10 lines
drivers/gpu/drm/i915/intel_uc.c +10
-0+u32 data[2 ]; + + vma =i915_gem_object_ggtt_pin (huc->fw.obj,NULL ,0 ,0 ,0 ); +if (IS_ERR (vma)) { +DRM_DEBUG_DRIVER ("failed to pin huc fw object %d\n" , + (int )PTR_ERR (vma)); +return ; + } + +
Leave only one line
Quoted 44 lines
drivers/gpu/drm/i915/intel_uc.c +29
-0+/* Invalidate GuC TLB to let GuC take the latest updates to GTT. */ +I915_WRITE (GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); + +/* Specify auth action and where public signature is. */ + data[0 ] =INTEL_GUC_ACTION_AUTHENTICATE_HUC ; + data[1 ] =i915_ggtt_offset (vma) + huc->fw.rsa_offset; + + ret =intel_guc_send (guc, data,ARRAY_SIZE (data)); +if (ret) { +DRM_ERROR ("HuC: GuC did not ack Auth request\n" ); + goto out; + } + +/* Check authentication status, it should be done by now */ + ret =intel_wait_for_register (dev_priv, +HUC_STATUS2 , +HUC_FW_VERIFIED , +HUC_FW_VERIFIED , +50 ); + +if (ret) { +DRM_ERROR ("HuC: Authentication failed\n" ); + goto out; + } + +DRM_ERROR ("HuC Authentication Successful!\n" ); +out: +i915_vma_unpin (vma); +}drivers/gpu/drm/i915/intel_uc.h +1
-0@@ -190,6 +190,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);int intel_guc_log_flush_complete (struct intel_guc *guc);int intel_guc_log_flush (struct intel_guc *guc);int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +void intel_guc_auth_huc (struct drm_i915_private *dev_priv);/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_i915_private *dev_priv);Signature · 1 line
2.7.4
with fixed above typos
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/8] drm/i915/huc: Support HuC authentication
In reply to Anusha SrivatsaQuoted 27 lines · Anusha Srivatsa
From: Peter Antoine <[email protected]>
The HuC authentication is done by host2guc call. The HuC RSA keys are sent to GuC for authentication.
v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changedwait_for_automictowait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Renameintel_huc_auh()tointel_guc_auth_huc()and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip
v13: rebased. Movedintel_guc_auth_hucfromi915_guc_submission.cto intel_uc.c.Update dev todev_privinintel_guc_auth_huc(). RenamedHOST2GUC_ACTION_AUTHENTICATE_HUCTOINTEL_GUC_ACTION_AUTHENTICATE_HUC
v14: rebased.
v15: rebased. Add newline onDRM_ERRORsthat already dont have one.
v16: rebased. Replacewait_forwithintel_wait_for_register()since the latter employs sleep optimisations for quick responses- as pointed out by Chris Wilson.
Quoted 3 lines
Cc Chris Wilson <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Michal Wajdeczko <[email protected]>
Typo in my email ;(
Quoted 16 lines
Tested-by Xiang Haihao <[email protected]>Signed-off-by Anusha Srivatsa <[email protected]>Signed-off-by Alex Dai <[email protected]>Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/intel_guc_fwif.h | 1 + drivers/gpu/drm/i915/intel_guc_loader.c | 2 + drivers/gpu/drm/i915/intel_uc.c | 70 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 72 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_guc_fwif.h +0
-0
drivers/gpu/drm/i915/intel_guc_fwif.h enum intel_guc_action { · line 509
Quoted 4 lines
drivers/gpu/drm/i915/intel_guc_fwif.h +1
-0@@ -506,6 +506,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , + INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
Can we keep actions in order of their code values?
Quoted 56 lines
drivers/gpu/drm/i915/intel_guc_fwif.h +0
-0INTEL_GUC_ACTION_LIMIT };drivers/gpu/drm/i915/intel_guc_loader.c +2
-0@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)intel_uc_fw_status_repr (guc_fw->fetch_status), intel_uc_fw_status_repr(guc_fw->load_status)); +intel_guc_auth_huc (dev_priv); +if (i915.enable_guc_submission) {if (i915.guc_log_level >=0 )gen9_enable_guc_interrupts (dev_priv);drivers/gpu/drm/i915/intel_uc.c +16
-2@@ -46,7 +46,7 @@ static bool intel_guc_recv(struct intel_guc *guc, u32 *status)int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len) {struct drm_i915_private *dev_priv =guc_to_i915 (guc); -u32 status; +u32 status =0 ;int i;int ret;@@ -71,7 +71,11 @@ int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len)* up to that length of time, then switch to a slower sleep-wait loop. * No inte_guc_send command should ever take longer than 10ms. */ - ret =wait_for_us (intel_guc_recv (guc, &status),10 ); + ret =intel_wait_for_register (dev_priv, +HUC_STATUS2 , +HUC_FW_VERIFIED , +HUC_FW_VERIFIED , +50 );if (ret) ret =wait_for (intel_guc_recv (guc, &status),10 );if (status !=INTEL_GUC_STATUS_SUCCESS ) {@@ -140,3 +144,65 @@ int intel_guc_log_control(struct intel_guc *guc, u32 control_val)return intel_guc_send (guc, action,ARRAY_SIZE (action)); } + +/** +* intel_guc_auth_huc() - authenticate ucode +* @dev_priv: the drm_i915_device +* +* Triggers a HuC fw authentication request to the GuC via intel_guc_action_ +* authenticate_huc interface. +* interface. +*/ +void intel_guc_auth_huc (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 166
Quoted 10 lines
drivers/gpu/drm/i915/intel_uc.c +10
-0+{ +struct intel_guc *guc = &dev_priv->guc; +struct intel_huc *huc = &dev_priv->huc; +struct i915_vma *vma; +int ret; +u32 data[2 ]; + +/* Bypass the case where there is no HuC firmware */ +if (huc->fw.fetch_status ==INTEL_UC_FIRMWARE_NONE || + huc->fw.load_status ==INTEL_UC_FIRMWARE_NONE )
To catch the case when there is no Huc fw, maybe only first check is needed as in intel_huc_load()?
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 170
Quoted 4 lines
drivers/gpu/drm/i915/intel_uc.c +4
-0+return ; + +if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS ) { +DRM_ERROR ("HuC: GuC fw wasn't loaded. Can't authenticate\n" );
This shall never happen as this function is called from guc_setup() only after successful guc fw load.
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 175
Quoted 5 lines
drivers/gpu/drm/i915/intel_uc.c +5
-0+return ; + } + +if (huc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS ) { +DRM_ERROR ("HuC: fw wasn't loaded. Nothing to authenticate\n" );
Hmm, we should already have error message about failed huc fw loading. Do we need to report other obvious failures?
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 181
Quoted 6 lines
drivers/gpu/drm/i915/intel_uc.c +6
-0+return ; + } + + vma =i915_gem_object_ggtt_pin (huc->fw.obj,NULL ,0 ,0 ,0 ); +if (IS_ERR (vma)) { +DRM_DEBUG_DRIVER ("pin failed %d\n" , (int )PTR_ERR (vma));
Please be more descriptive, what about "failed to pin huc fw obj" ?
Quoted 14 lines
drivers/gpu/drm/i915/intel_uc.c +14
-0+return ; + } + + +/* Invalidate GuC TLB to let GuC take the latest updates to GTT. */ +I915_WRITE (GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); + +/* Specify auth action and where public signature is. */ + data[0 ] =INTEL_GUC_ACTION_AUTHENTICATE_HUC ; + data[1 ] =i915_ggtt_offset (vma) + huc->fw.rsa_offset; + + ret =intel_guc_send (guc, data,ARRAY_SIZE (data)); +if (ret) { +DRM_ERROR ("HuC: GuC did not ack Auth request\n" );
drivers/gpu/drm/i915/intel_uc.c int intel_guc_log_control(struct intel_guc *guc, u32 control_val) · line 205
Quoted 10 lines
drivers/gpu/drm/i915/intel_uc.c +10
-0+ goto out; + } + +/* Check authentication status, it should be done by now */ + ret =wait_for ((I915_READ (HUC_STATUS2 ) &HUC_FW_VERIFIED ) >0 ,50 ); +if (ret) { +DRM_ERROR ("HuC: Authentication failed\n" ); + goto out; + } +
In other place you said:
"I think we need a message for the case when there is no failure."
What about adding message here that confirms Huc authentication?
Quoted 22 lines
drivers/gpu/drm/i915/intel_uc.c +3
-0+out: +i915_vma_unpin (vma); +}drivers/gpu/drm/i915/intel_uc.h +1
-0@@ -193,6 +193,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);int intel_guc_log_flush_complete (struct intel_guc *guc);int intel_guc_log_flush (struct intel_guc *guc);int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +void intel_guc_auth_huc (struct drm_i915_private *dev_priv);/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_i915_private *dev_priv);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/8 drm/i915/get_params: Add HuC status to getparams
In reply to Anusha SrivatsaFrom: Peter Antoine <[email protected]>
This patch will allow for getparams to return the status of the HuC. As the HuC has to be validated by the GuC this patch uses the validated status to show when the HuC is loaded and ready for use. You cannot use the loaded status as with the GuC as the HuC is verified after it is loaded and is not usable until it is verified.
v2: removed the forewakes as the registers are already force-woken.
(T.Ursulin)
v4: rebased.
v5: rebased on top of drm-tip.
v6: rebased. Removed any reference to intel_huc.h
v7: rebased. Rename I915_PARAM_HAS_HUC to I915_PARAM_HUC_STATUS. Remove intel_is_huc_valid() since it is used only in one place. Put the case of I915_PARAM_HAS_HUC() in the right place.
v8: rebased. Add a comment to specify that I915_READ(reg) does not read garbage value. The register HUC_STATUS2 is force woken and no rpm is needed.
v9: rebased.
--- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ drivers/gpu/drm/i915/intel_huc_loader.c | 1 - include/uapi/drm/i915_drm.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +7 -0
@@ -49,6 +49,7 @@#include "i915_trace.h" #include "i915_vgpu.h" #include "intel_drv.h" +#include "intel_uc.h" static struct drm_driver driver;
@@ -315,6 +316,12 @@ static int i915_getparam(struct drm_device *dev, void *data,case I915_PARAM_MIN_EU_IN_POOL : value =INTEL_INFO (dev_priv)->sseu.min_eu_in_pool;break ; +case I915_PARAM_HUC_STATUS : +/* The register is already force-woken. We dont need +* any rpm here +*/ + value =I915_READ (HUC_STATUS2 ) &HUC_FW_VERIFIED ; +break ;case I915_PARAM_MMAP_GTT_VERSION :/* Though we've started our numbering from 1, and so class all * earlier versions as 0, in effect their value is undefined as
drivers/gpu/drm/i915/intel_huc_loader.c +0 -1
@@ -281,4 +281,3 @@ void intel_huc_fini(struct drm_device *dev) huc_fw->fetch_status =INTEL_UC_FIRMWARE_NONE ; } -
include/uapi/drm/i915_drm.h +1 -0
@@ -395,6 +395,7 @@ typedef struct drm_i915_irq_wait {* priorities and the driver will attempt to execute batches in priority order. */ #define I915_PARAM_HAS_SCHEDULER 41 +#define I915_PARAM_HUC_STATUS 42 typedef struct drm_i915_getparam { __s32 param;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for HuC Loading Patches
In reply to Anusha Srivatsa== Series Details ==
== Series Details ==
Series: HuC Loading Patches
URL : https://patchwork.freedesktop.org/series/17499/
State : warning
== Summary ==
Series 17499v1 HuC Loading Patches
https://patchwork.freedesktop.org/api/1.0/series/17499/revisions/1/mbox/
Test kms_force_connector_basic:
Subgroup force-connector-state:
pass -> DMESG-WARN (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup bad-nb-words-3:
pass -> DMESG-WARN (fi-ivb-3770)fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:224 dwarn:1 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:246 pass:214 dwarn:1 dfail:0 fail:0 skip:31
ea0500897bf72bbbf6eca6e695c9d49289dfc768 drm-tip: 2017y-01m-04d-16h-46m-35s UTC integration manifest 97ae46d drm/i915/get_params: Add HuC status to getparams
454ee37 drm/i915/huc: Support HuC authentication
8024997 drm/i915/huc: Add debugfs for HuC loading status check
dc8952d drm/i915/HuC: Add KBL huC loading Support
96f12e1 drm/i915/huc: Add BXT HuC Loading Support
f5c922a drm/i915/huc: Add HuC fw loading support
0f4ad78 drm/i915/huc: Unified css_header struct for GuC and HuC
4278638 drm/i915/guc: Make the GuC fw loading helper functions general
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3432/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for HuC Loading Patches (rev2)
In reply to Anusha Srivatsa== Series Details ==
== Series Details ==
Series: HuC Loading Patches (rev2)
URL : https://patchwork.freedesktop.org/series/17499/
State : success
== Summary ==
Series 17499v2 HuC Loading Patches
https://patchwork.freedesktop.org/api/1.0/series/17499/revisions/2/mbox/
fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:82 pass:69 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
a947b47b6c0c947253f44d750512220ecb7c5cf4 drm-tip: 2017y-01m-11d-14h-32m-39s UTC integration manifest fabcb22 drm/i915/get_params: Add HuC status to getparams
3532699 drm/i915/huc: Support HuC authentication
50c8a56 drm/i915/huc: Add debugfs for HuC loading status check
5d14b30 drm/i915/HuC: Add KBL huC loading Support
6def1fb drm/i915/huc: Add BXT HuC Loading Support
e6713f5 drm/i915/huc: Add HuC fw loading support
061e51b drm/i915/huc: Unified css_header struct for GuC and HuC
6db7e21 drm/i915/guc: Make the GuC fw loading helper functions general
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3482/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx