|
@@ -27,8 +27,6 @@
|
|
|
#include "intel_guc_submission.h"
|
|
|
#include "i915_drv.h"
|
|
|
|
|
|
-static void guc_init_ggtt_pin_bias(struct intel_guc *guc);
|
|
|
-
|
|
|
static void gen8_guc_raise_irq(struct intel_guc *guc)
|
|
|
{
|
|
|
struct drm_i915_private *dev_priv = guc_to_i915(guc);
|
|
@@ -144,8 +142,6 @@ int intel_guc_init_misc(struct intel_guc *guc)
|
|
|
struct drm_i915_private *i915 = guc_to_i915(guc);
|
|
|
int ret;
|
|
|
|
|
|
- guc_init_ggtt_pin_bias(guc);
|
|
|
-
|
|
|
ret = guc_init_wq(guc);
|
|
|
if (ret)
|
|
|
return ret;
|
|
@@ -606,22 +602,6 @@ int intel_guc_resume(struct intel_guc *guc)
|
|
|
* to DRAM. The value of the GuC ggtt_pin_bias is the GuC WOPCM size.
|
|
|
*/
|
|
|
|
|
|
-/**
|
|
|
- * guc_init_ggtt_pin_bias() - Initialize the GuC ggtt_pin_bias value.
|
|
|
- * @guc: intel_guc structure.
|
|
|
- *
|
|
|
- * This function will calculate and initialize the ggtt_pin_bias value
|
|
|
- * based on the GuC WOPCM size.
|
|
|
- */
|
|
|
-static void guc_init_ggtt_pin_bias(struct intel_guc *guc)
|
|
|
-{
|
|
|
- struct drm_i915_private *i915 = guc_to_i915(guc);
|
|
|
-
|
|
|
- GEM_BUG_ON(!i915->wopcm.size);
|
|
|
-
|
|
|
- guc->ggtt_pin_bias = i915->wopcm.guc.size;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* intel_guc_allocate_vma() - Allocate a GGTT VMA for GuC usage
|
|
|
* @guc: the guc
|
|
@@ -640,6 +620,7 @@ struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size)
|
|
|
struct drm_i915_private *dev_priv = guc_to_i915(guc);
|
|
|
struct drm_i915_gem_object *obj;
|
|
|
struct i915_vma *vma;
|
|
|
+ u64 flags;
|
|
|
int ret;
|
|
|
|
|
|
obj = i915_gem_object_create(dev_priv, size);
|
|
@@ -650,8 +631,8 @@ struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size)
|
|
|
if (IS_ERR(vma))
|
|
|
goto err;
|
|
|
|
|
|
- ret = i915_vma_pin(vma, 0, 0,
|
|
|
- PIN_GLOBAL | PIN_OFFSET_BIAS | guc->ggtt_pin_bias);
|
|
|
+ flags = PIN_GLOBAL | PIN_OFFSET_BIAS | i915_ggtt_pin_bias(vma);
|
|
|
+ ret = i915_vma_pin(vma, 0, 0, flags);
|
|
|
if (ret) {
|
|
|
vma = ERR_PTR(ret);
|
|
|
goto err;
|
|
@@ -663,3 +644,20 @@ err:
|
|
|
i915_gem_object_put(obj);
|
|
|
return vma;
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * intel_guc_reserved_gtt_size()
|
|
|
+ * @guc: intel_guc structure
|
|
|
+ *
|
|
|
+ * The GuC WOPCM mapping shadows the lower part of the GGTT, so if we are using
|
|
|
+ * GuC we can't have any objects pinned in that region. This function returns
|
|
|
+ * the size of the shadowed region.
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * 0 if GuC is not present or not in use.
|
|
|
+ * Otherwise, the GuC WOPCM size.
|
|
|
+ */
|
|
|
+u32 intel_guc_reserved_gtt_size(struct intel_guc *guc)
|
|
|
+{
|
|
|
+ return guc_to_i915(guc)->wopcm.guc.size;
|
|
|
+}
|