1. 23 6月, 2015 3 次提交
    • J
      drm/i915: Merged the many do_execbuf() parameters into a structure · 5f19e2bf
      John Harrison 提交于
      The do_execbuf() function takes quite a few parameters. The actual set of
      parameters is going to change with the conversion to passing requests around.
      Further, it is due to grow massively with the arrival of the GPU scheduler.
      
      This patch simplifies the prototype by passing a parameter structure instead.
      Changing the parameter set in the future is then simply a matter of
      adding/removing items to the structure.
      
      Note that the structure does not contain absolutely everything that is passed
      in. This is because the intention is to use this structure more extensively
      later in this patch series and more especially in the GPU scheduler that is
      coming soon. The latter requires hanging on to the structure as the final
      hardware submission can be delayed until long after the execbuf IOCTL has
      returned to user land. Thus it is unsafe to put anything in the structure that
      is local to the IOCTL call itself - such as the 'args' parameter. All entries
      must be copies of data or pointers to structures that are reference counted in
      some way and guaranteed to exist for the duration of the batch buffer's life.
      
      v2: Rebased to newer tree and updated for changes to the command parser.
      Specifically, a code shuffle has required saving the batch start address in the
      params structure.
      
      For: VIZ-5115
      Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
      Reviewed-by: NTomas Elf <tomas.elf@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5f19e2bf
    • J
      drm/i915: i915_add_request must not fail · bf7dc5b7
      John Harrison 提交于
      The i915_add_request() function is called to keep track of work that has been
      written to the ring buffer. It adds epilogue commands to track progress (seqno
      updates and such), moves the request structure onto the right list and other
      such house keeping tasks. However, the work itself has already been written to
      the ring and will get executed whether or not the add request call succeeds. So
      no matter what goes wrong, there isn't a whole lot of point in failing the call.
      
      At the moment, this is fine(ish). If the add request does bail early on and not
      do the housekeeping, the request will still float around in the
      ring->outstanding_lazy_request field and be picked up next time. It means
      multiple pieces of work will be tagged as the same request and driver can't
      actually wait for the first piece of work until something else has been
      submitted. But it all sort of hangs together.
      
      This patch series is all about removing the OLR and guaranteeing that each piece
      of work gets its own personal request. That means that there is no more
      'hoovering up of forgotten requests'. If the request does not get tracked then
      it will be leaked. Thus the add request call _must_ not fail. The previous patch
      should have already ensured that it _will_ not fail by removing the potential
      for running out of ring space. This patch enforces the rule by actually removing
      the early exit paths and the return code.
      
      Note that if something does manage to fail and the epilogue commands don't get
      written to the ring, the driver will still hang together. The request will be
      added to the tracking lists. And as in the old case, any subsequent work will
      generate a new seqno which will suffice for marking the old one as complete.
      
      v2: Improved WARNings (Tomas Elf review request).
      
      For: VIZ-5115
      Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
      Reviewed-by: NTomas Elf <tomas.elf@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bf7dc5b7
    • J
      drm/i915: Reserve ring buffer space for i915_add_request() commands · 29b1b415
      John Harrison 提交于
      It is a bad idea for i915_add_request() to fail. The work will already have been
      send to the ring and will be processed, but there will not be any tracking or
      management of that work.
      
      The only way the add request call can fail is if it can't write its epilogue
      commands to the ring (cache flushing, seqno updates, interrupt signalling). The
      reasons for that are mostly down to running out of ring buffer space and the
      problems associated with trying to get some more. This patch prevents that
      situation from happening in the first place.
      
      When a request is created, it marks sufficient space as reserved for the
      epilogue commands. Thus guaranteeing that by the time the epilogue is written,
      there will be plenty of space for it. Note that a ring_begin() call is required
      to actually reserve the space (and do any potential waiting). However, that is
      not currently done at request creation time. This is because the ring_begin()
      code can allocate a request. Hence calling begin() from the request allocation
      code would lead to infinite recursion! Later patches in this series remove the
      need for begin() to do the allocate. At that point, it becomes safe for the
      allocate to call begin() and really reserve the space.
      
      Until then, there is a potential for insufficient space to be available at the
      point of calling i915_add_request(). However, that would only be in the case
      where the request was created and immediately submitted without ever calling
      ring_begin() and adding any work to that request. Which should never happen. And
      even if it does, and if that request happens to fall down the tiny window of
      opportunity for failing due to being out of ring space then does it really
      matter because the request wasn't doing anything in the first place?
      
      v2: Updated the 'reserved space too small' warning to include the offending
      sizes. Added a 'cancel' operation to clean up when a request is abandoned. Added
      re-initialisation of tracking state after a buffer wrap to keep the sanity
      checks accurate.
      
      v3: Incremented the reserved size to accommodate Ironlake (after finally
      managing to run on an ILK system). Also fixed missing wrap code in LRC mode.
      
      v4: Added extra comment and removed duplicate WARN (feedback from Tomas).
      
      For: VIZ-5115
      CC: Tomas Elf <tomas.elf@intel.com>
      Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      29b1b415
  2. 22 6月, 2015 2 次提交
  3. 20 6月, 2015 1 次提交
  4. 16 6月, 2015 1 次提交
  5. 15 6月, 2015 3 次提交
  6. 12 6月, 2015 4 次提交
  7. 29 5月, 2015 3 次提交
  8. 28 5月, 2015 1 次提交
  9. 27 5月, 2015 1 次提交
    • C
      drm/i915: Use spinlocks for checking when to waitboost · 8d3afd7d
      Chris Wilson 提交于
      In commit 1854d5ca
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Tue Apr 7 16:20:32 2015 +0100
      
          drm/i915: Deminish contribution of wait-boosting from clients
      
      we removed an atomic timer based check for allowing waitboosting and
      moved it below the mutex taken during RPS. However, that mutex can be
      held for long periods of time on Vallyview/Cherryview as communication
      with the PCU is slow. As clients may frequently wait for results (e.g.
      such as tranform feedback) we introduced contention between the client
      and the RPS worker. We can take advantage of the RPS worker, by
      switching the wait boost decision to use spin locks and defer the
      actual reclocking to the worker.
      
      Fixes a regression of up to 45% on Baytrail and Baswell!
      
      v2 (Daniel):
      - Use max_freq_softlimit instead of the not-yet-merged boost
        frequency.
      - Don't inject a fake irq into the boost work, instead treat
        client_boost as just another legit waker.
      
      v3: Drop the now unused mask (Chris).
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112
      Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8d3afd7d
  10. 23 5月, 2015 1 次提交
  11. 22 5月, 2015 2 次提交
    • C
      drm/i915: Introduce DRM_I915_THROTTLE_JIFFIES · d0bc54f2
      Chris Wilson 提交于
      As Daniel commented on
      
      commit b7ffe1362c5f468b853223acc9268804aa92afc8
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Mon Apr 27 13:41:24 2015 +0100
      
          drm/i915: Free RPS boosts for all laggards
      
      it is better to be explicit when sharing hardcoded values such as
      throttle/boost timeouts. Make it so!
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d0bc54f2
    • D
      drm/i915/skl: Deinit/init the display at suspend/resume · 5d96d8af
      Damien Lespiau 提交于
      We need to re-init the display hardware when going out of suspend. This
      includes:
      
        - Hooking the PCH to the reset logic
        - Restoring CDCDLK
        - Enabling the DDB power
      
      Among those, only the CDCDLK one is a bit tricky. There's some
      complexity in that:
      
        - DPLL0 (which is the source for CDCLK) has two VCOs, each with a set
          of supported frequencies. As eDP also uses DPLL0 for its link rate,
          once DPLL0 is on, we restrict the possible eDP link rates the chosen
          VCO.
        - CDCLK also limits the bandwidth available to push pixels.
      
      So, as a first step, this commit restore what the BIOS set, until I can
      do more testing.
      
      In case that's of interest for the reviewer, I've unit tested the
      function that derives the decimal frequency field:
      
        #include <stdio.h>
        #include <stdint.h>
        #include <assert.h>
      
        #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
      
        static const struct dpll_freq {
                unsigned int freq;
                unsigned int decimal;
        } freqs[] = {
                { .freq = 308570, .decimal = 0b01001100111},
                { .freq = 337500, .decimal = 0b01010100001},
                { .freq = 432000, .decimal = 0b01101011110},
                { .freq = 450000, .decimal = 0b01110000010},
                { .freq = 540000, .decimal = 0b10000110110},
                { .freq = 617140, .decimal = 0b10011010000},
                { .freq = 675000, .decimal = 0b10101000100},
        };
      
        static void intbits(unsigned int v)
        {
                int i;
      
                for(i = 10; i >= 0; i--)
                        putchar('0' + ((v >> i) & 1));
        }
      
        static unsigned int freq_decimal(unsigned int freq /* in kHz */)
        {
                return (freq - 1000) / 500;
        }
      
        static void test_freq(const struct dpll_freq *entry)
        {
                unsigned int decimal = freq_decimal(entry->freq);
      
                printf("freq: %d, expected: ", entry->freq);
                intbits(entry->decimal);
                printf(", got: ");
                intbits(decimal);
                putchar('\n');
      
                assert(decimal == entry->decimal);
        }
      
        int main(int argc, char **argv)
        {
                int i;
      
                for (i = 0; i < ARRAY_SIZE(freqs); i++)
                        test_freq(&freqs[i]);
      
                return 0;
        }
      
      v2:
        - Rebase on top of -nightly
        - Use (freq - 1000) / 500 for the decimal frequency (Ville)
        - Fix setting the enable bit of HSW_NDE_RSTWRN_OPT (Ville)
        - Rename skl_display_{resume,suspend} to skl_{init,uninit}_cdclk to
          be consistent with the BXT code (Ville)
        - Store boot CDCLK in ddi_pll_init (Ville)
        - Merge dev_priv's skl_boot_cdclk into cdclk_freq
        - Use LCPLL_PLL_LOCK instead of (1 << 30) (Ville)
        - Replace various '0' by SKL_DPLL0 to be a bit more explicit that
          we're programming DPLL0
        - Busy poll the PCU before doing the frequency change. It takes about
          3/4 cycles, each separated by 10us, to get the ACK from the CPU
          (Ville)
      
      v3:
        - Restore dev_priv->skl_boot_cdclk, leaving unification with
          dev_priv->cdclk_freq for a later patch (Daniel, Ville)
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5d96d8af
  12. 21 5月, 2015 4 次提交
    • C
      drm/i915: Convert RPS tracking to a intel_rps_client struct · 2e1b8730
      Chris Wilson 提交于
      Now that we have internal clients, rather than faking a whole
      drm_i915_file_private just for tracking RPS boosts, create a new struct
      intel_rps_client and pass it along when waiting.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: s/rq/req/]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2e1b8730
    • C
      drm/i915: Limit mmio flip RPS boosts · bcafc4e3
      Chris Wilson 提交于
      Since we will often pageflip to an active surface, we will often have to
      wait for the surface to be written before issuing the flip. Also we are
      likely to wait on that surface in plenty of time before the vblank.
      Since we have a mechanism for boosting when a flip misses the expected
      vblank, curtain the number of times we RPS boost when simply waiting for
      mmioflip.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: s/rq/req/]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bcafc4e3
    • C
      drm/i915: Limit ring synchronisation (sw sempahores) RPS boosts · a6f766f3
      Chris Wilson 提交于
      Ring switches can occur many times per frame, and are often out of
      control, causing frequent RPS boosting for no practical benefit. Treat
      the sw semaphore synchronisation as a separate client and only allow it
      to boost once per busy/idle cycle.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: s/rq/req/]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a6f766f3
    • C
      drm/i915: Implement inter-engine read-read optimisations · b4716185
      Chris Wilson 提交于
      Currently, we only track the last request globally across all engines.
      This prevents us from issuing concurrent read requests on e.g. the RCS
      and BCS engines (or more likely the render and media engines). Without
      semaphores, we incur costly stalls as we synchronise between rings -
      greatly impacting the current performance of Broadwell versus Haswell in
      certain workloads (like video decode). With the introduction of
      reference counted requests, it is much easier to track the last request
      per ring, as well as the last global write request so that we can
      optimise inter-engine read read requests (as well as better optimise
      certain CPU waits).
      
      v2: Fix inverted readonly condition for nonblocking waits.
      v3: Handle non-continguous engine array after waits
      v4: Rebase, tidy, rewrite ring list debugging
      v5: Use obj->active as a bitfield, it looks cool
      v6: Micro-optimise, mostly involving moving code around
      v7: Fix retire-requests-upto for execlists (and multiple rq->ringbuf)
      v8: Rebase
      v9: Refactor i915_gem_object_sync() to allow the compiler to better
      optimise it.
      
      Benchmark: igt/gem_read_read_speed
      hsw:gt3e (with semaphores):
      Before: Time to read-read 1024k:		275.794µs
      After:  Time to read-read 1024k:		123.260µs
      
      hsw:gt3e (w/o semaphores):
      Before: Time to read-read 1024k:		230.433µs
      After:  Time to read-read 1024k:		124.593µs
      
      bdw-u (w/o semaphores):             Before          After
      Time to read-read 1x1:            26.274µs       10.350µs
      Time to read-read 128x128:        40.097µs       21.366µs
      Time to read-read 256x256:        77.087µs       42.608µs
      Time to read-read 512x512:       281.999µs      181.155µs
      Time to read-read 1024x1024:    1196.141µs     1118.223µs
      Time to read-read 2048x2048:    5639.072µs     5225.837µs
      Time to read-read 4096x4096:   22401.662µs    21137.067µs
      Time to read-read 8192x8192:   89617.735µs    85637.681µs
      
      Testcase: igt/gem_concurrent_blit (read-read and friends)
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> [v8]
      [danvet: s/\<rq\>/req/g]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b4716185
  13. 20 5月, 2015 6 次提交
  14. 08 5月, 2015 8 次提交
    • D
      drm/i915: Update DRIVER_DATE to 20150508 · 214a2b7f
      Daniel Vetter 提交于
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      214a2b7f
    • V
      drm/i915: Work around DISPLAY_PHY_CONTROL register corruption on CHV · 70722468
      Ville Syrjälä 提交于
      Sometimes (exactly when is a bit unclear) DISPLAY_PHY_CONTROL appears to
      get corrupted. The values I've managed to read from it seem to have some
      pattern but vary quite a lot. The corruption doesn't seem to just happen
      when the register is accessed, but can also happen spontaneosly during
      modeset. When this happens during a modeset things go south and the
      display doesn't light up.
      
      I've managed to hit the problemn when toggling HDMI on port D on and
      off. When things get corrupted the display doesn't light up, but as soon
      as I manually write the correct value to the register the display comes
      up.
      
      First I was suspicious that we ourselves accidentally overwrite it with
      garbage, but didn't catch anything with the reg_rw tracepoint. Also I
      sprinkled check all over the modeset path to see exactly when the
      corruption happens, and eg. the read back value was fine just before
      intel_dp_set_m(), and corrupted immediately after it. I also made my
      check function repair the register value whenever it was wrong, and with
      this approach the corruption repeated several times during the modeset
      operation, always seeming to trigger in the same exact calls to the
      check function, while other calls to the function never caught anything.
      
      So far I've not seen this problem occurring when carefully avoiding all
      read accesses to DISPLAY_PHY_CONTROL. Not sure if that's just pure luck
      or an actual workaround, but we can hope it works. So let's avoid reading
      the register and instead track the desired value of the register in dev_priv.
      
      v2: Read out the power well state to determine initial register value
      v3: Use DPIO_CHx names instead of raw numbers
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NDeepak S <deepak.s@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      70722468
    • M
      drm/i915: Use the disable callback for disabling planes. · 27321ae8
      Maarten Lankhorst 提交于
      This allows disabling all planes affecting a crtc without caring what type it is.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      27321ae8
    • S
      drm/i915/skl: Add module parameter to select edp vswing table · 9e458034
      Sonika Jindal 提交于
      This provides an option to override the value set by VBT
      for selecting edp Vswing Pre-emph setting table.
      
      v2: Adding comment about this being a temporary workaround and
      making the parameter read-only (Jani)
      v3: Changing mode to 0400 instead of 0 (Jani)
      
      https://bugs.freedesktop.org/show_bug.cgi?id=89554Signed-off-by: NSonika Jindal <sonika.jindal@intel.com>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9e458034
    • D
    • S
      drm/i915/skl: Enable runtime PM · 00776511
      Suketu Shah 提交于
      Enable runtime PM for Skylake platform
      
      v2: After adding dmc ver 1.0 support rebased on top of nightly. (Animesh)
      
      Issue: VIZ-2819
      Signed-off-by: NA.Sunil Kamath <sunil.kamath@intel.com>
      Signed-off-by: NSuketu Shah <suketu.j.shah@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NAnimesh Manna <animesh.manna@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      00776511
    • S
      drm/i915/skl: Add DC5 Trigger Sequence · dc174300
      Suketu Shah 提交于
      Add triggers as per expectations mentioned in gen9_enable_dc5
      and gen9_disable_dc5 patch.
      
      Also call POSTING_READ for every write to a register to ensure that
      its written immediately.
      
      v1: Remove POSTING_READ calls as they've already been added in previous patches.
      
      v2: Rebase to move all runtime pm specific changes to intel_runtime_pm.c file.
      
      Modified as per review comments from Imre:
      1] Change variable name 'dc5_allowed' to 'dc5_enabled' to correspond to relevant
         functions.
      2] Move the check dc5_enabled in skl_set_power_well() to disable DC5 into
         gen9_disable_DC5 which is a more appropriate place.
      3] Convert checks for 'pm.dc5_enabled' and 'pm.suspended' in skl_set_power_well()
         to warnings. However, removing them for now as they'll be included in a future patch
         asserting DC-state entry/exit criteria.
      4] Enable DC5, only when CSR firmware is verified to be loaded. Create new structure
         to track 'enabled' and 'deferred' status of DC5.
      5] Ensure runtime PM reference is obtained, if CSR is not loaded, to avoid entering
         runtime-suspend and release it when it's loaded.
      6] Protect necessary CSR-related code with locks.
      7] Move CSR-loading call to runtime PM initialization, as power domains needed to be
         accessed during deferred DC5-enabling, are not initialized earlier.
      
      v3: Rebase to latest.
      
      Modified as per review comments from Imre:
      1] Use blocking wait for CSR-loading to finish to enable DC5  for simplicity, instead of
         deferring enabling DC5 until CSR is loaded.
      2] Obtain runtime PM reference during CSR-loading initialization itself as deferred DC5-
         enabling is removed and release it at the end of CSR-loading functionality.
      3] Revert calling CSR-loading functionality to the beginning of i915 driver-load
         functionality to avoid any delay in loading.
      4] Define another variable to track whether CSR-loading failed and use it to avoid enabling
         DC5 if it's true.
      5] Define CSR-load-status accessor functions for use later.
      
      v4:
      1] Disable DC5 before enabling PG2 instead of after it.
      2] DC5 was being mistaken enabled even when CSR-loading timed-out. Fix that.
      3] Enable DC5-related functionality using a macro.
      4] Remove dc5_enabled tracking variable and its use as it's not needed now.
      
      v5:
      1] Mark CSR failed to load where necessary in finish_csr_load function.
      2] Use mutex-protected accessor function to check if CSR loaded instead of directly
         accessing the variable.
      3] Prefix csr_load_status_get/set function names with intel_.
      
      v6: rebase to latest.
      v7: Rebase on top of nightly (Damien)
      v8: Squashed the patch from Imre - added csr helper pointers to simplify the code. (Imre)
      v9: After adding dmc ver 1.0 support rebased on top of nightly. (Animesh)
      v10: Added a enum for different csr states, suggested by Imre. (Animesh)
      
      v11: Based on review comments from Imre, Damien and Daniel following changes done
      - enum name chnaged to csr_state (singular form).
      - FW_UNINITIALIZED used as zeroth element in enum csr_state.
      - Prototype changed for helper function(set/get csr status), using enum csr_state instead of bool.
      
      v12: Based on review comment from Imre, introduced bool fw_loaded local to finish_csr_load() which helps
      calling once to set the csr status. The same flag used to fail RPM if find any issue during
      firmware loading.
      
      Issue: VIZ-2819
      Signed-off-by: NA.Sunil Kamath <sunil.kamath@intel.com>
      Signed-off-by: NSuketu Shah <suketu.j.shah@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NAnimesh Manna <animesh.manna@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      dc174300
    • D
      drm/i915/skl: Add support to load SKL CSR firmware. · eb805623
      Daniel Vetter 提交于
      Display Context Save and Restore support is needed for
      various SKL Display C states like DC5, DC6.
      
      This implementation is added based on first version of DMC CSR program
      that we received from h/w team.
      
      Here we are using request_firmware based design.
      Finally this firmware should end up in linux-firmware tree.
      
      For SKL platform its mandatory to ensure that we load this
      csr program before enabling DC states like DC5/DC6.
      
      As CSR program gets reset on various conditions, we should ensure
      to load it during boot and in future change to be added to load
      this system resume sequence too.
      
      v1: Initial relese as RFC patch
      
      v2: Design change as per Daniel, Damien and Shobit's review comments
      request firmware method followed.
      
      v3: Some optimization and functional changes.
      Pulled register defines into drivers/gpu/drm/i915/i915_reg.h
      Used kmemdup to allocate and duplicate firmware content.
      Ensured to free allocated buffer.
      
      v4: Modified as per review comments from Satheesh and Daniel
      Removed temporary buffer.
      Optimized number of writes by replacing I915_WRITE with I915_WRITE64.
      
      v5:
      Modified as per review comemnts from Damien.
      - Changed name for functions and firmware.
      - Introduced HAS_CSR.
      - Reverted back previous change and used csr_buf with u8 size.
      - Using cpu_to_be64 for endianness change.
      
      Modified as per review comments from Imre.
      - Modified registers and macro names to be a bit closer to bspec terminology
      and the existing register naming in the driver.
      - Early return for non SKL platforms in intel_load_csr_program function.
      - Added locking around CSR program load function as it may be called
      concurrently during system/runtime resume.
      - Releasing the fw before loading the program for consistency
      - Handled error path during f/w load.
      
      v6: Modified as per review comments from Imre.
      - Corrected out_freecsr sequence.
      
      v7: Modified as per review comments from Imre.
      Fail loading fw if fw->size%8!=0.
      
      v8: Rebase to latest.
      
      v9: Rebase on top of -nightly (Damien)
      
      v10: Enabled support for dmc firmware ver 1.0.
      According to ver 1.0 in a single binary package all the firmware's that are
      required for different stepping's of the product will be stored. The package
      contains the css header, followed by the package header and the actual dmc
      firmwares. Package header contains the firmware/stepping mapping table and
      the corresponding firmware offsets to the individual binaries, within the
      package. Each individual program binary contains the header and the payload
      sections whose size is specified in the header section. This changes are done
      to extract the specific firmaware from the package. (Animesh)
      
      v11: Modified as per review comemnts from Imre.
      - Added code comment from bpec for header structure elements.
      - Added __packed to avoid structure padding.
      - Added helper functions for stepping and substepping info.
      - Added code comment for CSR_MAX_FW_SIZE.
      - Disabled BXT firmware loading, will be enabled with dmc 1.0 support.
      - Changed skl_stepping_info based on bspec, earlier used from config DB.
      - Removed duplicate call of cpu_to_be* from intel_csr_load_program function.
      - Used cpu_to_be32 instead of cpu_to_be64 as firmware binary in dword aligned.
      - Added sanity check for header length.
      - Added sanity check for mmio address got from firmware binary.
      - kmalloc done separately for dmc header and dmc firmware. (Animesh)
      
      v12: Modified as per review comemnts from Imre.
      - Corrected the typo error in skl stepping info structure.
      - Added out-of-bound access for skl_stepping_info.
      - Sanity check for mmio address modified.
      - Sanity check added for stepping and substeppig.
      - Modified the intel_dmc_info structure, cache only the required header info. (Animesh)
      
      v13: clarify firmware load error message.
      The reason for a firmware loading failure can be obscure if the driver
      is built-in. Provide an explanation to the user about the likely reason for
      the failure and how to resolve it. (Imre)
      
      v14: Suggested by Jani.
      - fix s/I915/CONFIG_DRM_I915/ typo
      - add fw_path to the firmware object instead of using a static ptr (Jani)
      
      v15:
      1) Changed the firmware name as dmc_gen9.bin, everytime for a new firmware version a symbolic link
      with same name will help not to build kernel again.
      2) Changes done as per review comments from Imre.
      - Error check removed for intel_csr_ucode_init.
      - Moved csr-specific data structure to intel_csr.h and optimization done on structure definition.
      - fw->data used directly for parsing the header info & memory allocation
      only done separately for payload. (Animesh)
      
      v16:
      - No need for out_regs label in i915_driver_load(), so removed it.
      - Changed the firmware name as skl_dmc_ver1.bin, followed naming convention <platform>_dmc_<api-version>.bin (Animesh)
      
      Issue: VIZ-2569
      Signed-off-by: NA.Sunil Kamath <sunil.kamath@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NAnimesh Manna <animesh.manna@intel.com>
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      eb805623