Skip to contentSkip to conversation

HuC/GuC status to Get Params.

PATCH New Peter Antoine 1 participant 3 messages Sep 2, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 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.

v2: removed extra forcewakes that were not required. (T.Ursulin)
v3: simplify the parameter handling. (C.Wilson)
v4: rebased (and correctly ordered the defines).

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 | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_huc.h        |  2 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 14 ++++++++++++++
 include/uapi/drm/i915_drm.h             |  2 ++
 6 files changed, 44 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 v4 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.

v4: rebase.

---
 drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
 drivers/gpu/drm/i915/intel_guc.h        |  2 +-
 drivers/gpu/drm/i915/intel_guc_loader.c | 18 ++++++++++++++++++
 include/uapi/drm/i915_drm.h             |  1 +
 4 files changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index c285e55..a779b59 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;
 
@@ -362,6 +363,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		 */
 		value = i915_gem_mmap_gtt_version();
 		break;
+	case I915_PARAM_HAS_GUC:
+		value = intel_is_guc_valid(dev_priv);
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
drivers/gpu/drm/i915/intel_guc.h +1 -1
index efddaed..7a5adf7 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_i915_private *dev_priv);
 #endif
drivers/gpu/drm/i915/intel_guc_loader.c +18 -0
index 9be84bb5..139d696 100644
@@ -783,3 +783,21 @@ 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_i915_private *dev_priv)
+{
+	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 03725fe..629fb5e 100644
@@ -388,6 +388,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_POOLED_EU	 38
 #define I915_PARAM_MIN_EU_IN_POOL	 39
 #define I915_PARAM_MMAP_GTT_VERSION	 40
+#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 v4 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.

v2: removed the forewakes as the registers are already force-woken.

     (T.Ursulin)

v4: rebased.

---
 drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
 drivers/gpu/drm/i915/intel_huc.h        |  2 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 14 ++++++++++++++
 include/uapi/drm/i915_drm.h             |  1 +
 4 files changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index a779b59..29c4791 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;
@@ -366,6 +367,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_GUC:
 		value = intel_is_guc_valid(dev_priv);
 		break;
+	case I915_PARAM_HAS_HUC:
+		value = intel_is_huc_valid(dev_priv);
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
drivers/gpu/drm/i915/intel_huc.h +1 -1
index 946caa7..5eac625 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_i915_private *dev_priv);
 #endif
drivers/gpu/drm/i915/intel_huc_loader.c +14 -0
index 87a6948..d574183 100644
@@ -273,3 +273,17 @@ 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_priv:	drm device 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_i915_private *dev_priv)
+{
+	return ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0);
+}
+
include/uapi/drm/i915_drm.h +1 -0
index 629fb5e..d236520 100644
@@ -389,6 +389,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_MIN_EU_IN_POOL	 39
 #define I915_PARAM_MMAP_GTT_VERSION	 40
 #define I915_PARAM_HAS_GUC		 41
+#define I915_PARAM_HAS_HUC		 42
 
 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