Skip to contentSkip to conversation

HuC/GuC status to Get Params.

PATCH Superseded Peter Antoine 2 participants 4 messages Aug 18, 2016

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 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)

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 v3 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 | 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 499a6ff..da9c04d 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_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 e24847f..18a769b 100644
@@ -782,3 +782,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 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 v3 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)
---
 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 da9c04d..9abeee5 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_priv);
+		break;
 	case I915_PARAM_HAS_GUC:
 		value = intel_is_guc_valid(dev_priv);
 		break;
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 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

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

In reply to Peter Antoine
== Series Details ==

== Series Details ==

Series: HuC/GuC status to Get Params. (rev3)
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:66: 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:62: 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 b3e27f4d3138b9687ea8dc2bc915ddd30aaf4967 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