1. 28 7月, 2021 6 次提交
  2. 24 7月, 2021 1 次提交
  3. 23 7月, 2021 3 次提交
  4. 22 7月, 2021 3 次提交
    • J
      drm/i915: Use a table for i915_init/exit (v2) · a04ea6ae
      Jason Ekstrand 提交于
      If the driver was not fully loaded, we may still have globals lying
      around.  If we don't tear those down in i915_exit(), we'll leak a bunch
      of memory slabs.  This can happen two ways: use_kms = false and if we've
      run mock selftests.  In either case, we have an early exit from
      i915_init which happens after i915_globals_init() and we need to clean
      up those globals.
      
      The mock selftests case is especially sticky.  The load isn't entirely
      a no-op.  We actually do quite a bit inside those selftests including
      allocating a bunch of mock objects and running tests on them.  Once all
      those tests are complete, we exit early from i915_init().  Perviously,
      i915_init() would return a non-zero error code on failure and a zero
      error code on success.  In the success case, we would get to i915_exit()
      and check i915_pci_driver.driver.owner to detect if i915_init exited early
      and do nothing.  In the failure case, we would fail i915_init() but
      there would be no opportunity to clean up globals.
      
      The most annoying part is that you don't actually notice the failure as
      part of the self-tests since leaking a bit of memory, while bad, doesn't
      result in anything observable from userspace.  Instead, the next time we
      load the driver (usually for next IGT test), i915_globals_init() gets
      invoked again, we go to allocate a bunch of new memory slabs, those
      implicitly create debugfs entries, and debugfs warns that we're trying
      to create directories and files that already exist.  Since this all
      happens as part of the next driver load, it shows up in the dmesg-warn
      of whatever IGT test ran after the mock selftests.
      
      While the obvious thing to do here might be to call i915_globals_exit()
      after selftests, that's not actually safe.  The dma-buf selftests call
      i915_gem_prime_export which creates a file.  We call dma_buf_put() on
      the resulting dmabuf which calls fput() on the file.  However, fput()
      isn't immediate and gets flushed right before syscall returns.  This
      means that all the fput()s from the selftests don't happen until right
      before the module load syscall used to fire off the selftests returns
      which is after i915_init().  If we call i915_globals_exit() in
      i915_init() after selftests, we end up freeing slabs out from under
      objects which won't get released until fput() is flushed at the end of
      the module load syscall.
      
      The solution here is to let i915_init() return success early and detect
      the early success in i915_exit() and only tear down globals and nothing
      else.  This way the module loads successfully, regardless of the success
      or failure of the tests.  Because we've not enumerated any PCI devices,
      no device nodes are created and it's entirely useless from userspace.
      The only thing the module does at that point is hold on to a bit of
      memory until we unload it and i915_exit() is called.  Importantly, this
      means that everything from our selftests has the ability to properly
      flush out between i915_init() and i915_exit() because there is at least
      one syscall boundary in between.
      
      In order to handle all the delicate init/exit cases, we convert the
      whole thing to a table of init/exit pairs and track the init status in
      the new init_progress global.  This allows us to ensure that i915_exit()
      always tears down exactly the things that i915_init() successfully
      initialized.  We also allow early-exit of i915_init() without failure by
      an init function returning > 0.  This is useful for nomodeset, and
      selftests.  For the mock selftests, we convert them to always return 1
      so we get the desired behavior of the driver always succeeding to load
      the driver and then properly tearing down the partially loaded driver.
      
      v2 (Tvrtko Ursulin):
       - Guard init_funcs[i].exit with GEM_BUG_ON(i >= ARRAY_SIZE(init_funcs))
      v2 (Daniel Vetter):
       - Update the docstring for i915.mock_selftests
      Signed-off-by: NJason Ekstrand <jason@jlekstrand.net>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210721152358.2893314-4-jason@jlekstrand.net
      a04ea6ae
    • J
      drm/i915: Call i915_globals_exit() if pci_register_device() fails · db484889
      Jason Ekstrand 提交于
      In the unlikely event that pci_register_device() fails, we were tearing
      down our PMU setup but not globals.  This leaves a bunch of memory slabs
      lying around.
      Signed-off-by: NJason Ekstrand <jason@jlekstrand.net>
      Fixes: 32eb6bcf ("drm/i915: Make request allocation caches global")
      [danvet: Fix conflicts against removal of the globals_flush
      infrastructure.]
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210721152358.2893314-3-jason@jlekstrand.net
      db484889
    • J
  5. 08 7月, 2021 1 次提交
  6. 09 6月, 2021 1 次提交
  7. 20 5月, 2021 1 次提交
  8. 15 5月, 2021 1 次提交
  9. 07 5月, 2021 2 次提交
  10. 22 4月, 2021 1 次提交
  11. 21 4月, 2021 3 次提交
  12. 14 4月, 2021 5 次提交
  13. 25 3月, 2021 1 次提交
  14. 24 3月, 2021 2 次提交
    • M
      drm/i915/display: Simplify GLK display version tests · 2b5a4562
      Matt Roper 提交于
      GLK has always been a bit of a special case since it reports INTEL_GEN()
      as 9, but has version 10 display IP.  Now we can properly represent the
      display version as 10 and simplify the display generation tests
      throughout the display code.
      
      Aside from manually adding the version to the glk_info structure, the
      rest of this patch is generated with a Coccinelle semantic patch.  Note
      that we also need to switch any code that matches gen10 today but *not*
      GLK to be CNL-specific:
      
              @@ expression dev_priv; @@
              - DISPLAY_VER(dev_priv) > 9
              + DISPLAY_VER(dev_priv) >= 10
      
              @@ expression dev_priv, E; @@
              (
              - DISPLAY_VER(dev_priv) >= 10 && E
              + (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) && E
              |
              - DISPLAY_VER(dev_priv) >= 10
              + DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)
              |
              - IS_DISPLAY_RANGE(dev_priv, 10, E)
              + IS_DISPLAY_RANGE(dev_priv, 11, E) || IS_CANNONLAKE(dev_priv)
              )
      
              @@ expression dev_priv, E, E2; @@
              (
              - (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - E || IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv)
              + E || IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - IS_GEMINILAKE(dev_priv) || E || IS_CANNONLAKE(dev_priv)
              + E || IS_DISPLAY_VER(dev_priv, 10)
              |
              - E || IS_GEMINILAKE(dev_priv) || E2 || IS_CANNONLAKE(dev_priv)
              + E || E2 || IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_DISPLAY_VER(dev_priv, 10) || IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_GEMINILAKE(dev_priv) || IS_DISPLAY_VER(dev_priv, 10))
              + IS_DISPLAY_VER(dev_priv, 10)
              )
      
              @@ expression dev_priv; @@
              - (IS_DISPLAY_VER(dev_priv, 9) && !IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 9)
      
              @@ expression dev_priv; @@
              (
              - !(DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10))
              + DISPLAY_VER(dev_priv) < 10
              |
              - (DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10))
              + DISPLAY_VER(dev_priv) >= 10
              )
      
              @@ expression dev_priv, E; @@
              - E || DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10)
              + E || DISPLAY_VER(dev_priv) >= 10
      
              @@ expression dev_priv, E; @@
              - (IS_DISPLAY_RANGE(dev_priv, 11, E) || IS_DISPLAY_VER(dev_priv, 10))
              + IS_DISPLAY_RANGE(dev_priv, 10, E)
      
              @@ expression dev_priv; @@
              (
              - DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv) || IS_GEN9_LP(dev_priv)
              + DISPLAY_VER(dev_priv) >= 10 || IS_GEN9_LP(dev_priv)
              |
              - IS_GEN9_LP(dev_priv) || DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)
              + IS_GEN9_LP(dev_priv) || DISPLAY_VER(dev_priv) >= 10
              )
      
              @@ expression dev_priv, E; @@
              - !(DISPLAY_VER(dev_priv) >= E)
              + DISPLAY_VER(dev_priv) < E
      
      v2:
       - Convert gen10 conditions that don't include GLK into CNL conditions.
         (Ville)
      
      v3:
       - Rework coccinelle rules so that "ver>=10" turns into "ver>=11||is_cnl." (Ville)
      
      v3.1:
       - Manually re-add the ".display.version = 10" to glk_info after
         regenerating patch via Coccinelle.
      
      v4:
       - Also apply cocci rules to intel_pm.c and i915_irq.c!  (CI)
      
      Cc: Ville Syrjälä <ville.syrjala@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210322233840.4056851-1-matthew.d.roper@intel.com
      2b5a4562
    • M
      drm/i915: Add DISPLAY_VER() and related macros · 01eb15c9
      Matt Roper 提交于
      Although we've long referred to platforms by a single "GEN" number, the
      hardware teams have recommended that we stop doing this since the
      various component IP blocks are going to start using independent number
      schemes with varying cadence.  To support this, hardware platforms a bit
      down the road are going to start providing MMIO registers that the
      driver can read to obtain the "graphics version," "media version," and
      "display version" without needing to do a PCI ID -> platform -> version
      translation.
      
      Although our current platforms don't yet expose these registers (and the
      next couple we release probably won't have them yet either), the
      hardware teams would still like to see us move to this independent
      numbering scheme now in preparation.  For i915 that means we should try
      to eliminate all usage of INTEL_GEN() throughout our code and instead
      replace it with separate GRAPHICS_VER(), MEDIA_VER(), and DISPLAY_VER()
      constructs in the code.  For old platforms, these will all usually give
      the same value for each IP block (aside from a few special cases like
      GLK which we can no more accurately represent as graphics=9 +
      display=10), but future platforms will have more flexibility to bump IP
      version numbers independently.
      
      The upcoming ADL-P platform will have a display version of 13 and a
      graphics version of 12, so let's just the first step of breaking out
      DISPLAY_VER(), but leaving the rest of INTEL_GEN() untouched for now.
      For now we'll automatically derive the display version from the
      platform's INTEL_GEN() value except in cases where an alternative
      display version is explicitly provided in the device info structure.
      
      We also add some helper macros IS_DISPLAY_VER(i915, ver) and
      IS_DISPLAY_RANGE(i915, from, until) that match the behavior of the
      existing gen-based macros.  However unlike IS_GEN(), we will implement
      those macros with direct comparisons rather than trying to maintain a
      mask to help compiler optimization.  In practice the optimization winds
      up not being used in very many places (since the vast majority of our
      platform checks are of the form "gen >= x") so there is pretty minimal
      size reduction in the final driver binary[1].  We're also likely going
      to need to extend these version numbers to non-integer major.minor
      values at some point in the future, so the mask approach won't work at
      all once we get to platforms like that.
      
       [1] The results before/after the next patch in this series, which
           switches our code over to the new display macros:
      
              $ size i915.ko.{orig,new}
                 text    data     bss     dec     hex filename
              2940291  102944    5384 3048619  2e84ab i915.ko.orig
              2940723  102956    5384 3049063  2e8667 i915.ko.new
      
      v2:
       - Move version into device info's display sub-struct. (Jani)
       - Add extra parentheses to macros.  (Jani)
       - Note the lack of genmask optimization in the display-based macros and
         give size data.  (Lucas)
      
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210320044245.3920043-3-matthew.d.roper@intel.com
      01eb15c9
  15. 13 2月, 2021 1 次提交
    • M
      drm/i915: FPGA_DBG is display-specific · a321c3c6
      Matt Roper 提交于
      Although the bspec's description doesn't make it very clear, the
      hardware architects have confirmed that the FPGA_DBG register that we
      use to check for unclaimed MMIO accesses is display-specific and will
      only properly flag unclaimed MMIO transactions for registers in the
      display range.  If a platform doesn't have display, FPGA_DBG itself will
      not be available and should not be checked.  Let's move the feature flag
      into intel_device_info.display to more accurately reflect this.
      
      Given that we now know FPGA_DBG is display-specific, it could be argued
      that we should only check it on out intel_de_*() functions.  However
      let's not make that change right now; keeping the checks in all of the
      existing locations still helps us catch cases where regular
      intel_uncore_*() functions use bad MMIO offset math / base addresses and
      accidentally wind up landing within an unused area within the display
      MMIO range.  It will also help catch cases where userspace-initiated
      MMIO (e.g., IGT's intel_reg tool) attempt to read bad offsets within the
      display range.
      
      v2:  Add missing hunk with the update to the HAS_FPGA_DBG_UNCLAIMED
           macro.  (CI)
      
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210212222049.3516344-1-matthew.d.roper@intel.com
      a321c3c6
  16. 09 2月, 2021 1 次提交
  17. 21 1月, 2021 1 次提交
    • C
      drm/i915/adl_s: Add ADL-S platform info and PCI ids · 0883d63b
      Caz Yokoyama 提交于
      - Add the initial platform information for Alderlake-S.
      - Specify ppgtt_size value
      - Add dma_mask_size
      - Add ADLS REVIDs
      - HW tracking(Selective Update Tracking Enable) has been
        removed from ADLS. Disable PSR2 till we enable software/
        manual tracking.
      
      v2:
      - Add support for different ADLS SOC steppings to select
        correct GT/DISP stepping based on Bspec 53655 based on
        feedback from Matt Roper.(aswarup)
      
      v3:
      - Make display/gt steppings info generic for reuse with TGL and ADLS.
      - Modify the macros to reuse tgl_revids_get()
      - Add HTI support to adls device info.(mdroper)
      
      v4:
      - Rebase on TGL patch for applying WAs based on stepping info from
        Matt Roper's feedback.(aswarup)
      
      v5:
      - Replace macros with PCI IDs in revid to stepping table.
      
      v6: remove stray adls_revids (Lucas)
      
      Bspec: 53597
      Bspec: 53648
      Bspec: 53655
      Bspec: 48028
      Bspec: 53650
      BSpec: 50422
      
      Cc: José Roberto de Souza <jose.souza@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Signed-off-by: NCaz Yokoyama <caz.yokoyama@intel.com>
      Signed-off-by: NAditya Swarup <aditya.swarup@intel.com>
      Reviewed-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210119192931.1116500-2-lucas.demarchi@intel.com
      0883d63b
  18. 19 1月, 2021 1 次提交
  19. 09 1月, 2021 1 次提交
  20. 30 10月, 2020 1 次提交
  21. 22 10月, 2020 2 次提交
  22. 16 10月, 2020 1 次提交