• Paulo Zanoni's avatar
    drm/i915: refactor the IRQ init/reset macros · 68eb49b1
    Paulo Zanoni authored
    The whole point of having macros here is for the token pasting
    necessary to automatically have IMR, IIR and IER selected. We don't
    really need or want all the inlining that happens as a consequence.
    The good thing about the current code is that it works regardless of
    the relative offsets between these registers (they change after gen4,
    with the usual VLV/CHV exceptions).
    
    One thing which we can do is to split the logic of what we do with
    imr/ier/iir to functions separate from the macros that pick them.
    That's what we do in this commit. This allows us to get rid of the
    gen8 duplicates and also all the inlining:
    
    add/remove: 2/0 grow/shrink: 0/21 up/down: 384/-5949 (-5565)
    Function                                     old     new   delta
    gen3_irq_reset                                 -     233    +233
    gen3_irq_init                                  -     151    +151
    i8xx_irq_postinstall                         459     442     -17
    gen11_irq_postinstall                        804     744     -60
    ironlake_irq_postinstall                     450     353     -97
    vlv_display_irq_postinstall                  348     245    -103
    i965_irq_postinstall                         378     272    -106
    i915_irq_postinstall                         333     227    -106
    gen8_irq_power_well_post_enable              374     240    -134
    ironlake_irq_reset                           397     218    -179
    vlv_display_irq_reset                        616     433    -183
    i965_irq_reset                               374     180    -194
    cherryview_irq_reset                         379     185    -194
    i915_irq_reset                               407     209    -198
    ibx_irq_reset                                332     133    -199
    gen5_gt_irq_postinstall                      533     332    -201
    gen8_irq_power_well_pre_disable              434     204    -230
    gen8_gt_irq_postinstall                      469     196    -273
    gen8_de_irq_postinstall                     1200     836    -364
    gen5_gt_irq_reset                            471      76    -395
    gen8_gt_irq_reset                            775      99    -676
    gen8_irq_reset                              1100     333    -767
    gen11_irq_reset                             1959     686   -1273
    Total: Before=2259222, After=2253657, chg -0.25%
    
    v2:
     - Make checkpatch happy with a temporary which_ (Checkpatch).
     - Reorder the arguments for the INIT macros (Ville).
     - Correctly explain when the register offsets change in the commit
       message (Ville).
     - Use more line breaks in the macro calls to make the arguments look
       a little more organized/readable.
     - Update the bloat-o-meter output (minor change only).
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
    Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190410235344.31199-2-paulo.r.zanoni@intel.com
    68eb49b1
i915_irq.c 133 KB