1. 14 Dec, 2022 1 commit
  2. 13 Dec, 2022 1 commit
  3. 12 Dec, 2022 3 commits
  4. 09 Dec, 2022 7 commits
    • Alan Previn's avatar
      drm/i915/pxp: Promote pxp subsystem to top-level of i915 · f67986b0
      Alan Previn authored
      Starting with MTL, there will be two GT-tiles, a render and media
      tile. PXP as a service for supporting workloads with protected
      contexts and protected buffers can be subscribed by process
      workloads on any tile. However, depending on the platform,
      only one of the tiles is used for control events pertaining to PXP
      operation (such as creating the arbitration session and session
      tear-down).
      
      PXP as a global feature is accessible via batch buffer instructions
      on any engine/tile and the coherency across tiles is handled implicitly
      by the HW. In fact, for the foreseeable future, we are expecting this
      single-control-tile for the PXP subsystem.
      
      In MTL, it's the standalone media tile (not the root tile) because
      it contains the VDBOX and KCR engine (among the assets PXP relies on
      for those events).
      
      Looking at the current code design, each tile is represented by the
      intel_gt structure while the intel_pxp structure currently hangs off the
      intel_gt structure.
      
      Keeping the intel_pxp structure within the intel_gt structure makes some
      internal functionalities more straight forward but adds code complexity to
      code readability and maintainibility to many external-to-pxp subsystems
      which may need to pick the correct intel_gt structure. An example of this
      would be the intel_pxp_is_active or intel_pxp_is_enabled functionality
      which should be viewed as a global level inquiry, not a per-gt inquiry.
      
      That said, this series promotes the intel_pxp structure into the
      drm_i915_private structure making it a top-level subsystem and the PXP
      subsystem will select the control gt internally and keep a pointer to
      it for internal reference.
      
      This promotion comes with two noteworthy changes:
      
      1. Exported pxp functions that are called by external subsystems
         (such as intel_pxp_enabled/active) will have to check implicitly
         if i915->pxp is valid as that structure will not be allocated
         for HW that doesn't support PXP.
      
      2. Since GT is now considered a soft-dependency of PXP we are
         ensuring that GT init happens before PXP init and vice versa
         for fini. This causes a minor ordering change whereby we previously
         called intel_pxp_suspend after intel_uc_suspend but now is before
         i915_gem_suspend_late but the change is required for correct
         dependency flows. Additionally, this re-order change doesn't
         have any impact because at that point in either case, the top level
         entry to i915 won't observe any PXP events (since the GPU was
         quiesced during suspend_prepare). Also, any PXP event doesn't
         really matter when we disable the PXP HW (global GT irqs are
         already off anyway, so even if there was a bug that generated
         spurious events we wouldn't see it and we would just clean it
         up on resume which is okay since the default fallback action
         for PXP would be to keep the sessions off at this suspend stage).
      
      Changes from prior revs:
        v11: - Reformat a comment (Tvrtko).
        v10: - Change the code flow for intel_pxp_init to make it more
               cleaner and readible with better comments explaining the
               difference between full-PXP-feature vs the partial-teelink
               inits depending on the platform. Additionally, only do
               the pxp allocation when we are certain the subsystem is
               needed. (Tvrtko).
         v9: - Cosmetic cleanups in supported/enabled/active. (Daniele).
             - Add comments for intel_pxp_init and pxp_get_ctrl_gt that
               explain the functional flow for when PXP is not supported
               but the backend-assets are needed for HuC authentication
               (Daniele and Tvrtko).
             - Fix two remaining functions that are accessible outside
               PXP that need to be checking pxp ptrs before using them:
               intel_pxp_irq_handler and intel_pxp_huc_load_and_auth
               (Tvrtko and Daniele).
             - User helper macro in pxp-debugfs (Tvrtko).
         v8: - Remove pxp_to_gt macro (Daniele).
             - Fix a bug in pxp_get_ctrl_gt for the case of MTL and we don't
               support GSC-FW on it. (Daniele).
             - Leave i915->pxp as NULL if we dont support PXP and in line
               with that, do additional validity check on i915->pxp for
               intel_pxp_is_supported/enabled/active (Daniele).
             - Remove unncessary include header from intel_gt_debugfs.c
               and check drm_minor i915->drm.primary (Daniele).
             - Other cosmetics / minor issues / more comments on suspend
               flow order change (Daniele).
         v7: - Drop i915_dev_to_pxp and in intel_pxp_init use 'i915->pxp'
               through out instead of local variable newpxp. (Rodrigo)
             - In the case intel_pxp_fini is called during driver unload but
               after i915 loading failed without pxp being allocated, check
               i915->pxp before referencing it. (Alan)
         v6: - Remove HAS_PXP macro and replace it with intel_pxp_is_supported
               because : [1] introduction of 'ctrl_gt' means we correct this
               for MTL's upcoming series now. [2] Also, this has little impact
               globally as its only used by PXP-internal callers at the moment.
             - Change intel_pxp_init/fini to take in i915 as its input to avoid
               ptr-to-ptr in init/fini calls.(Jani).
             - Remove the backpointer from pxp->i915 since we can use
               pxp->ctrl_gt->i915 if we need it. (Rodrigo).
         v5: - Switch from series to single patch (Rodrigo).
             - change function name from pxp_get_kcr_owner_gt to
               pxp_get_ctrl_gt.
             - Fix CI BAT failure by removing redundant call to intel_pxp_fini
               from driver-remove.
             - NOTE: remaining open still persists on using ptr-to-ptr
               and back-ptr.
         v4: - Instead of maintaining intel_pxp as an intel_gt structure member
               and creating a number of convoluted helpers that takes in i915 as
               input and redirects to the correct intel_gt or takes any intel_gt
               and internally replaces with the correct intel_gt, promote it to
               be a top-level i915 structure.
         v3: - Rename gt level helper functions to "intel_pxp_is_enabled/
               supported/ active_on_gt" (Daniele)
             - Upgrade _gt_supports_pxp to replace what was intel_gtpxp_is
               supported as the new intel_pxp_is_supported_on_gt to check for
               PXP feature support vs the tee support for huc authentication.
               Fix pxp-debugfs-registration to use only the former to decide
               support. (Daniele)
             - Couple minor optimizations.
         v2: - Avoid introduction of new device info or gt variables and use
               existing checks / macros to differentiate the correct GT->PXP
               control ownership (Daniele Ceraolo Spurio)
             - Don't reuse the updated global-checkers for per-GT callers (such
               as other files within PXP) to avoid unnecessary GT-reparsing,
               expose a replacement helper like the prior ones. (Daniele).
         v1: - Add one more patch to the series for the intel_pxp suspend/resume
               for similar refactoring
      
      References: https://patchwork.freedesktop.org/patch/msgid/20221202011407.4068371-1-alan.previn.teres.alexis@intel.comSigned-off-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Acked-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208180542.998148-1-alan.previn.teres.alexis@intel.com
      f67986b0
    • Daniele Ceraolo Spurio's avatar
      drm/i915/mtl: MTL has one GSC CS on the media GT · e6d6e9d0
      Daniele Ceraolo Spurio authored
      Now that we have the GSC FW support code as a user to the GSC CS, we
      can add the relevant flag to the engine mask. Note that the engine will
      still be disabled until we define the GSC FW binary file.
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-7-daniele.ceraolospurio@intel.com
      e6d6e9d0
    • Jonathan Cavitt's avatar
      drm/i915/gsc: Disable GSC engine and power well if FW is not selected · 6b7cbdbe
      Jonathan Cavitt authored
      The GSC CS is only used for communicating with the GSC FW, so no need to
      initialize it if we're not going to use the FW. If we're not using
      neither the engine nor the microcontoller, then we can also disable the
      power well.
      
      IMPORTANT: lack of GSC FW breaks media C6 due to opposing requirements
      between CS setup and forcewake idleness. See in-code comment for detail.
      Signed-off-by: default avatarJonathan Cavitt <jonathan.cavitt@intel.com>
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: John C Harrison <John.C.Harrison@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-6-daniele.ceraolospurio@intel.com
      6b7cbdbe
    • Daniele Ceraolo Spurio's avatar
      drm/i915/gsc: Do a driver-FLR on unload if GSC was loaded · 5a44fcd7
      Daniele Ceraolo Spurio authored
      If the GSC was loaded, the only way to stop it during the driver unload
      flow is to do a driver-FLR.
      The driver-initiated FLR is not the same as PCI config space FLR in
      that it doesn't reset the SGUnit and doesn't modify the PCI config
      space. Thus, it doesn't require a re-enumeration of the PCI BARs.
      However, the driver-FLR does cause a memory wipe of graphics memory
      on all discrete GPU platforms or a wipe limited to stolen memory
      on the integrated GPU platforms.
      
      We perform the FLR as the last action before releasing the MMIO bar, so
      that we don't have to care about the consequences of the reset on the
      unload flow.
      
      v2: rename FLR function, add comment to explain FLR impact (Rodrigo),
          better explain why GSC needs FLR (Alan)
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Signed-off-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-5-daniele.ceraolospurio@intel.com
      5a44fcd7
    • Daniele Ceraolo Spurio's avatar
      drm/i915/gsc: GSC firmware loading · 15bd4a67
      Daniele Ceraolo Spurio authored
      GSC FW is loaded by submitting a dedicated command via the GSC engine.
      The memory area used for loading the FW is then re-purposed as local
      memory for the GSC itself, so we use a separate allocation instead of
      using the one where we keep the firmware stored for reload.
      
      The GSC is not reset as part of GT reset, so we only need to load it on
      first boot and S3/S4 exit.
      
      v2: use REG_* for register fields definitions (Rodrigo), move to WQ
          immediately
      
      v3: mark worker function as static
      
      Bspec: 63347, 65346
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
      Cc: John Harrison <John.C.Harrison@Intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Reviewed-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-4-daniele.ceraolospurio@intel.com
      15bd4a67
    • Daniele Ceraolo Spurio's avatar
      drm/i915/gsc: Skip the version check when fetching the GSC FW · f0ce5178
      Daniele Ceraolo Spurio authored
      The current exectation from the FW side is that the driver will query
      the GSC FW version after the FW is loaded, similarly to what the mei
      driver does on DG2. However, we're discussing with the FW team if there
      is a way to extract the version from the bin file before loading, so we
      can keep the code the same as for older FWs.
      
      Since the GSC FW version is not currently required for functionality and
      is only needed for debug purposes, we can skip the FW version for now at
      fetch time and add it later on when we've agreed on the approach.
      
      v2: rebased on uc_fw version struct changes.
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
      Cc: John Harrison <John.C.Harrison@Intel.com>
      Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> #v1
      Reviewed-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-3-daniele.ceraolospurio@intel.com
      f0ce5178
    • Daniele Ceraolo Spurio's avatar
      drm/i915/uc: Introduce GSC FW · 242c4b91
      Daniele Ceraolo Spurio authored
      On MTL the GSC FW needs to be loaded on the media GT by the graphics
      driver. We're going to treat it like a new uc_fw, so add the initial
      defs and init/fini functions for it.
      
      Similarly to the other FWs, the GSC FW path can be overridden via
      modparam. The modparam can also be used to disable the GSC FW loading by
      setting it to an empty string.
      
      Note that the new structure has been called intel_gsc_uc to avoid
      confusion with the existing intel_gsc, which instead represents the heci
      gsc interfaces.
      
      v2: re-order Makefile list to be properly sorted (Jani, Alan), better
          comment (alan)
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
      Cc: John Harrison <John.C.Harrison@Intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Reviewed-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221208200521.2928378-2-daniele.ceraolospurio@intel.com
      242c4b91
  5. 08 Dec, 2022 1 commit
  6. 07 Dec, 2022 2 commits
  7. 06 Dec, 2022 5 commits
  8. 05 Dec, 2022 3 commits
  9. 02 Dec, 2022 1 commit
    • Matt Roper's avatar
      drm/i915/mtl: Add hardware-level lock for steering · 3100240b
      Matt Roper authored
      Starting with MTL, the driver needs to not only protect the steering
      control register from simultaneous software accesses, but also protect
      against races with hardware/firmware agents.  The hardware provides a
      dedicated locking mechanism to support this via the MTL_STEER_SEMAPHORE
      register.  Reading the register acts as a 'trylock' operation; the read
      will return 0x1 if the lock is acquired or 0x0 if something else is
      already holding the lock; once acquired, writing 0x1 to the register
      will release the lock.
      
      We'll continue to grab the software lock as well, just so lockdep can
      track our locking; assuming the hardware lock is behaving properly,
      there should never be any contention on the software lock in this case.
      
      v2:
       - Extend hardware semaphore timeout and add a taint for CI if it ever
         happens (this would imply misbehaving hardware/firmware).  (Mika)
       - Add "MTL_" prefix to new steering semaphore register.  (Mika)
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221128233014.4000136-5-matthew.d.roper@intel.com
      3100240b
  10. 01 Dec, 2022 2 commits
  11. 30 Nov, 2022 6 commits
  12. 29 Nov, 2022 2 commits
  13. 28 Nov, 2022 2 commits
  14. 24 Nov, 2022 2 commits
  15. 23 Nov, 2022 2 commits