OSDN Git Service

drm/i915/uc: Drop explicit ggtt param in some uc_fw functions
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 11 Dec 2019 12:45:49 +0000 (12:45 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 11 Dec 2019 21:34:31 +0000 (21:34 +0000)
There is no need to pass explicit ggtt since we already have
a trick to get parent gt from uc_fw, we only need to use it.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191211124549.59516-4-michal.wajdeczko@intel.com
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c

index 380f36f..b6aedee 100644 (file)
@@ -389,8 +389,9 @@ fail:
        return err;
 }
 
-static u32 uc_fw_ggtt_offset(struct intel_uc_fw *uc_fw, struct i915_ggtt *ggtt)
+static u32 uc_fw_ggtt_offset(struct intel_uc_fw *uc_fw)
 {
+       struct i915_ggtt *ggtt = __uc_fw_to_gt(uc_fw)->ggtt;
        struct drm_mm_node *node = &ggtt->uc_fw;
 
        GEM_BUG_ON(!drm_mm_node_allocated(node));
@@ -405,7 +406,7 @@ static void uc_fw_bind_ggtt(struct intel_uc_fw *uc_fw)
        struct drm_i915_gem_object *obj = uc_fw->obj;
        struct i915_ggtt *ggtt = __uc_fw_to_gt(uc_fw)->ggtt;
        struct i915_vma dummy = {
-               .node.start = uc_fw_ggtt_offset(uc_fw, ggtt),
+               .node.start = uc_fw_ggtt_offset(uc_fw),
                .node.size = obj->base.size,
                .pages = obj->mm.pages,
                .vm = &ggtt->vm,
@@ -424,7 +425,7 @@ static void uc_fw_unbind_ggtt(struct intel_uc_fw *uc_fw)
 {
        struct drm_i915_gem_object *obj = uc_fw->obj;
        struct i915_ggtt *ggtt = __uc_fw_to_gt(uc_fw)->ggtt;
-       u64 start = uc_fw_ggtt_offset(uc_fw, ggtt);
+       u64 start = uc_fw_ggtt_offset(uc_fw);
 
        ggtt->vm.clear_range(&ggtt->vm, start, obj->base.size);
 }
@@ -443,7 +444,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, u32 dst_offset, u32 dma_flags)
        intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 
        /* Set the source address for the uCode */
-       offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt);
+       offset = uc_fw_ggtt_offset(uc_fw);
        GEM_BUG_ON(upper_32_bits(offset) & 0xFFFF0000);
        intel_uncore_write_fw(uncore, DMA_ADDR_0_LOW, lower_32_bits(offset));
        intel_uncore_write_fw(uncore, DMA_ADDR_0_HIGH, upper_32_bits(offset));