[Intel-gfx] [CI] drm/i915: do not pass dev_priv to low-level forcewake functions

Chris Wilson chris at chris-wilson.co.uk
Sat Mar 16 09:56:22 UTC 2019


Quoting Chris Wilson (2019-03-16 09:43:20)
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> 
> The only usage we have for it is for the regs pointer. Save a pointer to
> the set and ack registers instead of the register offsets to remove this
> requirement
> 
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Link: https://patchwork.freedesktop.org/patch/msgid/20190313231319.711-2-daniele.ceraolospurio@intel.com

add/remove: 0/0 grow/shrink: 6/12 up/down: 98/-81 (17)
Function                                     old     new   delta
fw_domain_init                               320     350     +30
fw_domains_put                                98     123     +25
fw_domains_get                               563     585     +22
intel_uncore_forcewake_reset                 459     478     +19
hdmi_port_clock_valid                        319     320      +1
g4x_pre_enable_dp                            364     365      +1
ring_request_alloc                          1852    1851      -1
intel_engine_lookup_user                      50      49      -1
gen11_irq_handler                            738     737      -1
__intel_uncore_forcewake_get                 115     112      -3
intel_uncore_fw_release_timer                198     194      -4
i915_forcewake_domains                       154     150      -4
fw_domain_fini                               172     168      -4
__intel_uncore_forcewake_put                 163     159      -4
___force_wake_auto                           138     134      -4
__err_print_to_sgl                          4058    4052      -6
fw_domains_get_with_fallback                 875     866      -9
fw_domain_wait_ack_with_fallback             490     450     -40

Hmm, a bit of a mixed bag due to the repeated pointer chasing inside the
inner loops.

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index cb78dcddc9cb..ee57d3a407b2 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -175,9 +175,10 @@ fw_domain_wait_ack_clear_fallback(const struct intel_uncore_forcewake_domain *d)
 }

 static inline void
-fw_domain_get(const struct intel_uncore_forcewake_domain *d)
+fw_domain_get(const struct intel_uncore *uncore,
+             const struct intel_uncore_forcewake_domain *d)
 {
-       fw_set(d, forcewake_domain_to_uncore(d)->fw_set);
+       fw_set(d, uncore->fw_set);
 }

 static inline void
@@ -199,62 +200,66 @@ fw_domain_wait_ack_set_fallback(const struct intel_uncore_forcewake_domain *d)
 }

 static inline void
-fw_domain_put(const struct intel_uncore_forcewake_domain *d)
+fw_domain_put(const struct intel_uncore *uncore,
+             const struct intel_uncore_forcewake_domain *d)
 {
-       fw_set(d, forcewake_domain_to_uncore(d)->fw_clear);
+       fw_set(d, uncore->fw_clear);
 }

 static void
 fw_domains_get(struct drm_i915_private *i915, enum forcewake_domains fw_domains)
 {
+       struct intel_uncore *uncore = &i915->uncore;
        struct intel_uncore_forcewake_domain *d;
        unsigned int tmp;

-       GEM_BUG_ON(fw_domains & ~i915->uncore.fw_domains);
+       GEM_BUG_ON(fw_domains & ~uncore->fw_domains);

        for_each_fw_domain_masked(d, fw_domains, i915, tmp) {
                fw_domain_wait_ack_clear(d);
-               fw_domain_get(d);
+               fw_domain_get(uncore, d);
        }

        for_each_fw_domain_masked(d, fw_domains, i915, tmp)
                fw_domain_wait_ack_set(d);

-       i915->uncore.fw_domains_active |= fw_domains;
+       uncore->fw_domains_active |= fw_domains;
 }

 static void
 fw_domains_get_with_fallback(struct drm_i915_private *i915,
                             enum forcewake_domains fw_domains)
 {
+       struct intel_uncore *uncore = &i915->uncore;
        struct intel_uncore_forcewake_domain *d;
        unsigned int tmp;

-       GEM_BUG_ON(fw_domains & ~i915->uncore.fw_domains);
+       GEM_BUG_ON(fw_domains & ~uncore->fw_domains);

        for_each_fw_domain_masked(d, fw_domains, i915, tmp) {
                fw_domain_wait_ack_clear_fallback(d);
-               fw_domain_get(d);
+               fw_domain_get(uncore, d);
        }

        for_each_fw_domain_masked(d, fw_domains, i915, tmp)
                fw_domain_wait_ack_set_fallback(d);

-       i915->uncore.fw_domains_active |= fw_domains;
+       uncore->fw_domains_active |= fw_domains;
 }

 static void
 fw_domains_put(struct drm_i915_private *i915, enum forcewake_domains fw_domains)
 {
+       struct intel_uncore *uncore = &i915->uncore;
        struct intel_uncore_forcewake_domain *d;
        unsigned int tmp;

-       GEM_BUG_ON(fw_domains & ~i915->uncore.fw_domains);
+       GEM_BUG_ON(fw_domains & ~uncore->fw_domains);

        for_each_fw_domain_masked(d, fw_domains, i915, tmp)
-               fw_domain_put(d);
+               fw_domain_put(uncore, d);

-       i915->uncore.fw_domains_active &= ~fw_domains;
+       uncore->fw_domains_active &= ~fw_domains;
 }

Now gives,

add/remove: 0/0 grow/shrink: 4/14 up/down: 51/-140 (-89)
Function                                     old     new   delta
fw_domain_init                               320     350     +30
intel_uncore_forcewake_reset                 459     478     +19
hdmi_port_clock_valid                        319     320      +1
g4x_pre_enable_dp                            364     365      +1
ring_request_alloc                          1852    1851      -1
intel_engine_lookup_user                      50      49      -1
gen11_irq_handler                            738     737      -1
__intel_uncore_forcewake_get                 115     112      -3
intel_uncore_fw_release_timer                198     194      -4
i915_forcewake_domains                       154     150      -4
fw_domain_fini                               172     168      -4
__intel_uncore_forcewake_put                 163     159      -4
___force_wake_auto                           138     134      -4
fw_domains_put                                98      92      -6
__err_print_to_sgl                          4058    4052      -6
fw_domains_get                               563     548     -15
fw_domain_wait_ack_with_fallback             490     450     -40
fw_domains_get_with_fallback                 875     828     -47

-Chris


More information about the Intel-gfx mailing list