Skip to contentSkip to conversation

HuC/GuC status to Get Params.

PATCH Superseded Peter Antoine 3 participants 6 messages Aug 16, 2016

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover HuC/GuC status to Get Params.

As it states on the tin. Add the HuC/GuC patches to the Get params so that they can be accessed from userspace. This is a requirement for the opensourcing of media codecs that require the HuC/GuC.

These patches require the HuC enabling patches. patchset: HuC Loading Patches.

Peter Antoine (2):
drm/i915/get_params: Add GuC status to getparams drm/i915/get_params: Add HuC status to getparams

 drivers/gpu/drm/i915/i915_drv.c         |  8 ++++++++
 drivers/gpu/drm/i915/intel_guc.h        |  2 +-
 drivers/gpu/drm/i915/intel_guc_loader.c | 19 +++++++++++++++++++
 drivers/gpu/drm/i915/intel_huc.h        |  2 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 21 +++++++++++++++++++++
 include/uapi/drm/i915_drm.h             |  2 ++
 6 files changed, 52 insertions(+), 2 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/2 drm/i915/get_params: Add GuC status to getparams

This patch returns the GuC status to the caller. It is used so that the userspace knows if the GuC has been loaded.

---
 drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
 drivers/gpu/drm/i915/intel_guc.h        |  2 +-
 drivers/gpu/drm/i915/intel_guc_loader.c | 19 +++++++++++++++++++
 include/uapi/drm/i915_drm.h             |  1 +
 4 files changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index 499a6ff..c8fc3d0 100644
@@ -49,6 +49,7 @@
 #include "i915_trace.h"
 #include "i915_vgpu.h"
 #include "intel_drv.h"
+#include "intel_guc.h"
 
 static struct drm_driver driver;
 
@@ -354,6 +355,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_MIN_EU_IN_POOL:
 		value = INTEL_INFO(dev)->min_eu_in_pool;
 		break;
+	case I915_PARAM_HAS_GUC:
+		value = intel_is_guc_valid(dev);
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
drivers/gpu/drm/i915/intel_guc.h +1 -1
index efddaed..5e8bb1e 100644
@@ -166,5 +166,5 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
 int i915_guc_wq_check_space(struct drm_i915_gem_request *rq);
 void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
 void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
-
+int intel_is_guc_valid(struct drm_device *dev);
 #endif
drivers/gpu/drm/i915/intel_guc_loader.c +19 -0
index e24847f..e99278f 100644
@@ -782,3 +782,22 @@ void intel_guc_fini(struct drm_device *dev)
 
 	guc_fw->fetch_status = UC_FIRMWARE_NONE;
 }
+
+/**
+ * intel_is_guc_valid() - Check to see if the GuC is fully loaded.
+ * @dev:	drm dedvice to check.
+ *
+ * This function will return true if the guc has been loaded and
+ * has valid firmware.
+ */
+int intel_is_guc_valid(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct intel_uc_fw *guc_fw = &dev_priv->guc.guc_fw;
+
+	if (guc_fw->load_status == UC_FIRMWARE_SUCCESS)
+		return 1;
+	else
+		return 0;
+}
+
include/uapi/drm/i915_drm.h +1 -0
index 452629d..ff8ce86 100644
@@ -387,6 +387,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_SOFTPIN	 37
 #define I915_PARAM_HAS_POOLED_EU	 38
 #define I915_PARAM_MIN_EU_IN_POOL	 39
+#define I915_PARAM_HAS_GUC			41
 
 typedef struct drm_i915_getparam {
 	__s32 param;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/2 drm/i915/get_params: Add HuC status to getparams

In reply to Peter Antoine

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.

---
 drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
 drivers/gpu/drm/i915/intel_huc.h        |  2 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 21 +++++++++++++++++++++
 include/uapi/drm/i915_drm.h             |  1 +
 4 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index c8fc3d0..909297e 100644
@@ -49,6 +49,7 @@
 #include "i915_trace.h"
 #include "i915_vgpu.h"
 #include "intel_drv.h"
+#include "intel_huc.h"
 #include "intel_guc.h"
 
 static struct drm_driver driver;
@@ -355,6 +356,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_MIN_EU_IN_POOL:
 		value = INTEL_INFO(dev)->min_eu_in_pool;
 		break;
+	case I915_PARAM_HAS_HUC:
+		value = intel_is_huc_valid(dev);
+		break;
 	case I915_PARAM_HAS_GUC:
 		value = intel_is_guc_valid(dev);
 		break;
drivers/gpu/drm/i915/intel_huc.h +1 -1
index 946caa7..8c1847a 100644
@@ -40,5 +40,5 @@ extern void intel_huc_init(struct drm_device *dev);
 extern int intel_huc_load(struct drm_device *dev);
 extern void intel_huc_auth(struct drm_device *dev);
 extern void intel_huc_fini(struct drm_device *dev);
-
+extern int intel_is_huc_valid(struct drm_device *dev);
 #endif
drivers/gpu/drm/i915/intel_huc_loader.c +21 -0
index 87a6948..ee42d5e 100644
@@ -273,3 +273,24 @@ void intel_huc_fini(struct drm_device *dev)
 
 	huc_fw->fetch_status = UC_FIRMWARE_NONE;
 }
+
+/**
+ * intel_is_huc_valid() - Check to see if the HuC is fully loaded.
+ * @dev:	drm dedvice to check.
+ *
+ * This function will return true if the guc has been loaded and
+ * has valid firmware. The simplest way of doing this is to check
+ * if the HuC has been validated, if so it must have been loaded.
+ */
+int intel_is_huc_valid(struct drm_device *dev)
+{
+	int result;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+	result = ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0);
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
+
+	return result;
+}
+
include/uapi/drm/i915_drm.h +1 -0
index ff8ce86..525d040 100644
@@ -387,6 +387,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_SOFTPIN	 37
 #define I915_PARAM_HAS_POOLED_EU	 38
 #define I915_PARAM_MIN_EU_IN_POOL	 39
+#define I915_PARAM_HAS_HUC			40
 #define I915_PARAM_HAS_GUC			41
 
 typedef struct drm_i915_getparam {
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/2] drm/i915/get_params: Add HuC status to getparams

Quoted 62 lines · Peter Antoine

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.

---
  drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
  drivers/gpu/drm/i915/intel_huc.h        |  2 +-
  drivers/gpu/drm/i915/intel_huc_loader.c | 21 +++++++++++++++++++++
  include/uapi/drm/i915_drm.h             |  1 +
  4 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index c8fc3d0..909297e 100644
@@ -49,6 +49,7 @@
  #include "i915_trace.h"
  #include "i915_vgpu.h"
  #include "intel_drv.h"
+#include "intel_huc.h"
  #include "intel_guc.h"
 
  static struct drm_driver driver;
@@ -355,6 +356,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
  	case I915_PARAM_MIN_EU_IN_POOL:
  		value = INTEL_INFO(dev)->min_eu_in_pool;
  		break;
+	case I915_PARAM_HAS_HUC:
+		value = intel_is_huc_valid(dev);
+		break;
  	case I915_PARAM_HAS_GUC:
  		value = intel_is_guc_valid(dev);
  		break;
drivers/gpu/drm/i915/intel_huc.h +1 -1
index 946caa7..8c1847a 100644
@@ -40,5 +40,5 @@ extern void intel_huc_init(struct drm_device *dev);
  extern int intel_huc_load(struct drm_device *dev);
  extern void intel_huc_auth(struct drm_device *dev);
  extern void intel_huc_fini(struct drm_device *dev);
-
+extern int intel_is_huc_valid(struct drm_device *dev);
  #endif
drivers/gpu/drm/i915/intel_huc_loader.c +7 -0
index 87a6948..ee42d5e 100644
@@ -273,3 +273,24 @@ void intel_huc_fini(struct drm_device *dev)
 
  	huc_fw->fetch_status = UC_FIRMWARE_NONE;
  }
+
+/**
+ * intel_is_huc_valid() - Check to see if the HuC is fully loaded.
+ * @dev:	drm dedvice to check.
+ *
+ * This function will return true if the guc has been loaded and
+ * has valid firmware. The simplest way of doing this is to check

drivers/gpu/drm/i915/intel_huc_loader.c void intel_huc_fini(struct drm_device *dev) · line 292

Quoted 10 lines
drivers/gpu/drm/i915/intel_huc_loader.c +10 -0
+ * if the HuC has been validated, if so it must have been loaded.
+ */
+int intel_is_huc_valid(struct drm_device *dev)
+{
+	int result;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+	result = ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0);
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);

Is there a special reason why it is required to grab all forcewakes?

HUC_STATUS2 is 0xd3b0 which appears to be in the media forcewake range already defined for gen9. So I915_READ will already grab that one.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/2] drm/i915/get_params: Add HuC status to getparams

Quoted 78 lines · Tvrtko Ursulin
Quoted 63 lines · Peter Antoine

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.

---
  drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
  drivers/gpu/drm/i915/intel_huc.h        |  2 +-
  drivers/gpu/drm/i915/intel_huc_loader.c | 21 +++++++++++++++++++++
  include/uapi/drm/i915_drm.h             |  1 +
  4 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index c8fc3d0..909297e 100644
@@ -49,6 +49,7 @@
  #include "i915_trace.h"
  #include "i915_vgpu.h"
  #include "intel_drv.h"
+#include "intel_huc.h"
  #include "intel_guc.h"
 
  static struct drm_driver driver;
@@ -355,6 +356,9 @@ static int i915_getparam(struct drm_device *dev, void 
 *data,
  	case I915_PARAM_MIN_EU_IN_POOL:
  		value = INTEL_INFO(dev)->min_eu_in_pool;
  		break;
+	case I915_PARAM_HAS_HUC:
+		value = intel_is_huc_valid(dev);
+		break;
  	case I915_PARAM_HAS_GUC:
  		value = intel_is_guc_valid(dev);

break;

drivers/gpu/drm/i915/intel_huc.h +1 -1
index 946caa7..8c1847a 100644
@@ -40,5 +40,5 @@ extern void intel_huc_init(struct drm_device *dev);
  extern int intel_huc_load(struct drm_device *dev);
  extern void intel_huc_auth(struct drm_device *dev);
  extern void intel_huc_fini(struct drm_device *dev);
-
+extern int intel_is_huc_valid(struct drm_device *dev);
  #endif
drivers/gpu/drm/i915/intel_huc_loader.c +7 -0
index 87a6948..ee42d5e 100644
@@ -273,3 +273,24 @@ void intel_huc_fini(struct drm_device *dev)
 
  	huc_fw->fetch_status = UC_FIRMWARE_NONE;
  }
+
+/**
+ * intel_is_huc_valid() - Check to see if the HuC is fully loaded.
+ * @dev:	drm dedvice to check.
+ *
+ * This function will return true if the guc has been loaded and
+ * has valid firmware. The simplest way of doing this is to check

drivers/gpu/drm/i915/intel_huc_loader.c void intel_huc_fini(struct drm_device *dev) · line 292

Quoted 10 lines
drivers/gpu/drm/i915/intel_huc_loader.c +10 -0
+ * if the HuC has been validated, if so it must have been loaded.
+ */
+int intel_is_huc_valid(struct drm_device *dev)
+{
+	int result;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+	result = ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0);
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);

Is there a special reason why it is required to grab all forcewakes?

Quoted 1 line

HUC_STATUS2 is 0xd3b0 which appears to be in the media forcewake range already defined for gen9. So I915_READ will already grab that one.

No, was just coping the code from the GuC loader. Will remove the forcewakes.

Thanks,
Peter.

Quoted 5 lines

Regards,

Tvrtko

--
Peter Antoine (Android Graphics Driver Software Engineer)
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Ro.CI.BAT: failure for HuC/GuC status to Get Params.

In reply to Peter Antoine
== Series Details ==

== Series Details ==

Series: HuC/GuC status to Get Params.
URL : https://patchwork.freedesktop.org/series/11158/
State : failure

== Summary ==

Applying: drm/i915/get_params: Add GuC status to getparams
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_drv.c
M drivers/gpu/drm/i915/intel_guc.h
M drivers/gpu/drm/i915/intel_guc_loader.c
M include/uapi/drm/i915_drm.h
.git/rebase-apply/patch:67: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging include/uapi/drm/i915_drm.h
Auto-merging drivers/gpu/drm/i915/intel_guc_loader.c
Auto-merging drivers/gpu/drm/i915/intel_guc.h
Auto-merging drivers/gpu/drm/i915/i915_drv.c
Applying: drm/i915/get_params: Add HuC status to getparams
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_drv.c
A drivers/gpu/drm/i915/intel_huc.h
A drivers/gpu/drm/i915/intel_huc_loader.c
M include/uapi/drm/i915_drm.h
.git/rebase-apply/patch:69: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging include/uapi/drm/i915_drm.h
CONFLICT (modify/delete): drivers/gpu/drm/i915/intel_huc_loader.c deleted in 95d30385a9c356e2102fdee51b36d1bc7704aba8 and modified in drm/i915/get_params: Add HuC status to getparams. Version drm/i915/get_params: Add HuC status to getparams of drivers/gpu/drm/i915/intel_huc_loader.c left in tree. Auto-merging drivers/gpu/drm/i915/i915_gem.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_gem.h
Auto-merging drivers/gpu/drm/i915/i915_drv.c
error: Failed to merge in the changes.
Patch failed at 0002 drm/i915/get_params: Add HuC status to getparams
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx