drm/i915/pxp: Promote pxp subsystem to top-level of i915
Subsystems (3)
PATCH v9 1/1 drm/i915/pxp: Promote pxp subsystem to top-level of i915
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 readibility 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:
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/[email protected]
--- .../drm/i915/display/skl_universal_plane.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_create.c | 2 +- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 5 - drivers/gpu/drm/i915/gt/intel_gt_debugfs.c | 2 - drivers/gpu/drm/i915/gt/intel_gt_irq.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 8 -- drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 - drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c | 2 +- drivers/gpu/drm/i915/i915_driver.c | 18 ++++ drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 94 ++++++++++++++----- drivers/gpu/drm/i915/pxp/intel_pxp.h | 9 +- drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 8 +- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c | 47 +++++++--- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h | 4 +- drivers/gpu/drm/i915/pxp/intel_pxp_huc.c | 2 +- drivers/gpu/drm/i915/pxp/intel_pxp_irq.c | 16 ++-- drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 6 +- drivers/gpu/drm/i915/pxp/intel_pxp_session.c | 10 +- drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 31 +++--- drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 8 ++ 23 files changed, 184 insertions(+), 110 deletions(-)
drivers/gpu/drm/i915/display/skl_universal_plane.c +1 -1
@@ -1848,7 +1848,7 @@ static bool bo_has_valid_encryption(struct drm_i915_gem_object *obj) {struct drm_i915_private *i915 =to_i915 (obj->base.dev); -return intel_pxp_key_check (&to_gt (i915)->pxp, obj, false) ==0 ; +return intel_pxp_key_check (i915->pxp, obj, false) ==0 ; }static bool pxp_is_borked (struct drm_i915_gem_object *obj)
drivers/gpu/drm/i915/gem/i915_gem_context.c +3 -3
@@ -257,7 +257,7 @@ static int proto_context_set_protected(struct drm_i915_private *i915,if (!protected) { pc->uses_protected_content = false; - }else if (!intel_pxp_is_enabled (&to_gt (i915)->pxp)) { + }else if (!intel_pxp_is_enabled (i915->pxp)) { ret = -ENODEV ; }else if ((pc->user_flags &BIT (UCONTEXT_RECOVERABLE )) || !(pc->user_flags &BIT (UCONTEXT_BANNABLE ))) {
@@ -271,8 +271,8 @@ static int proto_context_set_protected(struct drm_i915_private *i915,*/ pc->pxp_wakeref =intel_runtime_pm_get (&i915->runtime_pm); -if (!intel_pxp_is_active (&to_gt (i915)->pxp)) - ret =intel_pxp_start (&to_gt (i915)->pxp); +if (!intel_pxp_is_active (i915->pxp)) + ret =intel_pxp_start (i915->pxp); }return ret;
drivers/gpu/drm/i915/gem/i915_gem_create.c +1 -1
@@ -384,7 +384,7 @@ static int ext_set_protected(struct i915_user_extension __user *base, void *dataif (ext.flags)return -EINVAL ; -if (!intel_pxp_is_enabled (&to_gt (ext_data->i915)->pxp)) +if (!intel_pxp_is_enabled (ext_data->i915->pxp))return -ENODEV ; ext_data->flags |=I915_BO_PROTECTED ;
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -1
@@ -869,7 +869,7 @@ static struct i915_vma *eb_lookup_vma(struct i915_execbuffer *eb, u32 handle)*/ if (i915_gem_context_uses_protected_content (eb->gem_context) &&i915_gem_object_is_protected (obj)) { - err =intel_pxp_key_check (&vm->gt->pxp, obj, true); + err =intel_pxp_key_check (eb->i915->pxp, obj, true);if (err) {i915_gem_object_put (obj);return ERR_PTR (err);
drivers/gpu/drm/i915/gt/intel_gt.c +0 -5
@@ -8,7 +8,6 @@#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" -#include "pxp/intel_pxp.h" #include "i915_drv.h" #include "i915_perf_oa_regs.h"
@@ -762,8 +761,6 @@ int intel_gt_init(struct intel_gt *gt)intel_migrate_init (>->migrate, gt); -intel_pxp_init (>->pxp); - goto out_fw; err_gt:__intel_gt_disable (gt);
@@ -803,8 +800,6 @@ void intel_gt_driver_unregister(struct intel_gt *gt)intel_rps_driver_unregister (>->rps);intel_gsc_fini (>->gsc); -intel_pxp_fini (>->pxp); -/* * Upon unregistering the device to prevent any new users, cancel * all in-flight requests so that we can quickly unbind the active
drivers/gpu/drm/i915/gt/intel_gt_debugfs.c +0 -2
@@ -12,7 +12,6 @@#include "intel_gt_mcr.h" #include "intel_gt_pm_debugfs.h" #include "intel_sseu_debugfs.h" -#include "pxp/intel_pxp_debugfs.h" #include "uc/intel_uc_debugfs.h" int intel_gt_debugfs_reset_show (struct intel_gt *gt,u64 *val)
@@ -99,7 +98,6 @@ void intel_gt_debugfs_register(struct intel_gt *gt)intel_sseu_debugfs_register (gt, root);intel_uc_debugfs_register (>->uc, root); -intel_pxp_debugfs_register (>->pxp, root); } void intel_gt_debugfs_register_files(struct dentry *root,
drivers/gpu/drm/i915/gt/intel_gt_irq.c +1 -1
@@ -76,7 +76,7 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,return gen11_rps_irq_handler (&media_gt->rps, iir);if (instance ==OTHER_KCR_INSTANCE ) -return intel_pxp_irq_handler (>->pxp, iir); +return intel_pxp_irq_handler (gt->i915->pxp, iir);if (instance ==OTHER_GSC_INSTANCE )return intel_gsc_irq_handler (gt, iir);
drivers/gpu/drm/i915/gt/intel_gt_pm.c +0 -8
@@ -304,8 +304,6 @@ int intel_gt_resume(struct intel_gt *gt)intel_uc_resume (>->uc); -intel_pxp_resume (>->pxp); -user_forcewake (gt, false); out_fw:
@@ -339,8 +337,6 @@ void intel_gt_suspend_prepare(struct intel_gt *gt) {user_forcewake (gt, true);wait_for_suspend (gt); - -intel_pxp_suspend_prepare (>->pxp); }static suspend_state_t pm_suspend_target (void )
@@ -365,7 +361,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)GEM_BUG_ON (gt->awake);intel_uc_suspend (>->uc); -intel_pxp_suspend (>->pxp);/* * On disabling the device, we want to turn off HW access to memory
@@ -393,7 +388,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)void intel_gt_runtime_suspend (struct intel_gt *gt) { -intel_pxp_runtime_suspend (>->pxp);intel_uc_runtime_suspend (>->uc);GT_TRACE (gt,"\n" );
@@ -411,8 +405,6 @@ int intel_gt_runtime_resume(struct intel_gt *gt)if (ret)return ret; -intel_pxp_runtime_resume (>->pxp); -return 0 ; }
drivers/gpu/drm/i915/gt/intel_gt_types.h +0 -3
@@ -30,7 +30,6 @@#include "intel_rps_types.h" #include "intel_migrate_types.h" #include "intel_wakeref.h" -#include "pxp/intel_pxp_types.h" #include "intel_wopcm.h" struct drm_i915_private ;
@@ -275,8 +274,6 @@ struct intel_gt {u8 wb_index;/* Only used on HAS_L3_CCS_READ() platforms */ } mocs; -struct intel_pxp pxp; -/* gt/gtN sysfs */ struct kobject sysfs_gt;
drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c +1 -1
@@ -32,7 +32,7 @@ int intel_huc_fw_load_and_auth_via_gsc(struct intel_huc *huc)GEM_WARN_ON (intel_uc_fw_is_loaded (&huc->fw)); - ret =intel_pxp_huc_load_and_auth (&huc_to_gt (huc)->pxp); + ret =intel_pxp_huc_load_and_auth (huc_to_gt (huc)->i915->pxp);if (ret)return ret;
drivers/gpu/drm/i915/i915_driver.c +18 -0
@@ -73,6 +73,8 @@#include "gt/intel_gt_pm.h" #include "gt/intel_rc6.h" +#include "pxp/intel_pxp.h" +#include "pxp/intel_pxp_debugfs.h" #include "pxp/intel_pxp_pm.h" #include "i915_file_private.h"
@@ -759,6 +761,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)for_each_gt (gt, dev_priv, i)intel_gt_driver_register (gt); +intel_pxp_debugfs_register (dev_priv->pxp); +i915_hwmon_register (dev_priv);intel_display_driver_register (dev_priv);
@@ -790,6 +794,8 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)intel_display_driver_unregister (dev_priv); +intel_pxp_fini (dev_priv); +for_each_gt (gt, dev_priv, i)intel_gt_driver_unregister (gt);
@@ -933,6 +939,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_cleanup_modeset2; +intel_pxp_init (i915); + ret =intel_modeset_init (i915);if (ret) goto out_cleanup_gem;
@@ -1168,6 +1176,8 @@ static int i915_drm_prepare(struct drm_device *dev) {struct drm_i915_private *i915 =to_i915 (dev); +intel_pxp_suspend_prepare (i915->pxp); +/* * NB intel_display_suspend() may issue new requests after we've * ostensibly marked the GPU as ready-to-sleep here. We need to
@@ -1248,6 +1258,8 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)disable_rpm_wakeref_asserts (rpm); +intel_pxp_suspend (dev_priv->pxp); +i915_gem_suspend_late (dev_priv);for_each_gt (gt, dev_priv, i)
@@ -1360,6 +1372,8 @@ static int i915_drm_resume(struct drm_device *dev)i915_gem_resume (dev_priv); +intel_pxp_resume (dev_priv->pxp); +intel_modeset_init_hw (dev_priv);intel_init_clock_gating (dev_priv);intel_hpd_init (dev_priv);
@@ -1643,6 +1657,8 @@ static int intel_runtime_suspend(struct device *kdev)*/ i915_gem_runtime_suspend (dev_priv); +intel_pxp_runtime_suspend (dev_priv->pxp); +for_each_gt (gt, dev_priv, i)intel_gt_runtime_suspend (gt);
@@ -1747,6 +1763,8 @@ static int intel_runtime_resume(struct device *kdev)for_each_gt (gt, dev_priv, i)intel_gt_runtime_resume (gt); +intel_pxp_runtime_resume (dev_priv->pxp); +/* * On VLV/CHV display interrupts are part of the display * power well, so hpd is reinitialized from there. For
drivers/gpu/drm/i915/i915_drv.h +3 -4
@@ -72,6 +72,7 @@ struct intel_encoder;struct intel_limit ;struct intel_overlay_error_state ;struct vlv_s0ix_state ; +struct intel_pxp ;#define I915_GEM_GPU_DOMAINS \ (I915_GEM_DOMAIN_RENDER | \
@@ -364,6 +365,8 @@ struct drm_i915_private {struct file *mmap_singleton; } gem; +struct intel_pxp *pxp; +u8 pch_ssc_use;/* For i915gm/i945gm vblank irq workaround */
@@ -919,10 +922,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_GLOBAL_MOCS_REGISTERS (dev_priv) (INTEL_INFO(dev_priv)->has_global_mocs) -#define HAS_PXP (dev_priv) ((IS_ENABLED(CONFIG_DRM_I915_PXP) && \ - INTEL_INFO(dev_priv)->has_pxp) && \ - VDBOX_MASK(to_gt(dev_priv))) -#define HAS_GMCH (dev_priv) (INTEL_INFO(dev_priv)->display.has_gmch)#define HAS_GMD_ID (i915) (INTEL_INFO(i915)->has_gmd_id)
drivers/gpu/drm/i915/pxp/intel_pxp.c +70 -24
173 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp.h +5 -4
@@ -9,15 +9,16 @@#include <linux/errno.h> #include <linux/types.h> -struct intel_pxp ;struct drm_i915_gem_object ; +struct drm_i915_private ; +struct intel_pxp ; -struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp); +bool intel_pxp_is_supported (const struct intel_pxp *pxp);bool intel_pxp_is_enabled (const struct intel_pxp *pxp);bool intel_pxp_is_active (const struct intel_pxp *pxp); -void intel_pxp_init (struct intel_pxp *pxp); -void intel_pxp_fini (struct intel_pxp *pxp); +int intel_pxp_init (struct drm_i915_private *i915); +void intel_pxp_fini (struct drm_i915_private *i915);void intel_pxp_init_hw (struct intel_pxp *pxp);void intel_pxp_fini_hw (struct intel_pxp *pxp);
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c +5 -3
@@ -3,9 +3,6 @@* Copyright(c) 2020, Intel Corporation. All rights reserved. */ -#include "intel_pxp.h" -#include "intel_pxp_cmd.h" -#include "intel_pxp_session.h" #include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gpu_commands.h"
@@ -13,6 +10,11 @@#include "i915_trace.h" +#include "intel_pxp.h" +#include "intel_pxp_cmd.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" +/* stall until prior PXP and MFX/HCP/HUC objects are cmopleted */ #define MFX_WAIT_PXP (MFX_WAIT | \ MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | \
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +32 -15
87 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h +2 -2
@@ -10,10 +10,10 @@ struct intel_pxp;struct dentry ;#ifdef CONFIG_DRM_I915_PXP -void intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root); +void intel_pxp_debugfs_register (struct intel_pxp *pxp);#else static inline void -intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root) +intel_pxp_debugfs_register (struct intel_pxp *pxp) { }#endif
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +1 -1
@@ -18,7 +18,7 @@int intel_pxp_huc_load_and_auth (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct intel_huc *huc = >->uc.huc;struct pxp43_start_huc_auth_in huc_in = {0 };struct pxp43_start_huc_auth_out huc_out = {0 };
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +10 -6
@@ -3,14 +3,18 @@* Copyright(c) 2020 Intel Corporation. */ #include <linux/workqueue.h> -#include "intel_pxp.h" -#include "intel_pxp_irq.h" -#include "intel_pxp_session.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_regs.h" #include "gt/intel_gt_types.h" +#include "i915_irq.h" #include "i915_reg.h" + +#include "intel_pxp.h" +#include "intel_pxp_irq.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" #include "intel_runtime_pm.h" /**
@@ -20,7 +24,7 @@*/ void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;if (GEM_WARN_ON (!intel_pxp_is_enabled (pxp)))return ;
@@ -62,7 +66,7 @@ static inline void pxp_irq_reset(struct intel_gt *gt)void intel_pxp_irq_enable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;spin_lock_irq (gt->irq_lock);
@@ -77,7 +81,7 @@ void intel_pxp_irq_enable(struct intel_pxp *pxp)void intel_pxp_irq_disable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* * We always need to submit a global termination when we re-enable the
drivers/gpu/drm/i915/pxp/intel_pxp_pm.c +4 -2
@@ -3,11 +3,13 @@* Copyright(c) 2020 Intel Corporation. */ +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_irq.h" #include "intel_pxp_pm.h" #include "intel_pxp_session.h" -#include "i915_drv.h" +#include "intel_pxp_types.h" void intel_pxp_suspend_prepare (struct intel_pxp *pxp) {
@@ -26,7 +28,7 @@ void intel_pxp_suspend(struct intel_pxp *pxp)if (!intel_pxp_is_enabled (pxp))return ; - with_intel_runtime_pm(&pxp_to_gt(pxp)->i915->runtime_pm, wakeref) { + with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref) {intel_pxp_fini_hw (pxp); pxp->hw_state_invalidated = false; }
drivers/gpu/drm/i915/pxp/intel_pxp_session.c +5 -5
@@ -20,7 +20,7 @@static bool intel_pxp_session_is_in_play (struct intel_pxp *pxp,u32 id) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 sip =0 ;
@@ -33,7 +33,7 @@ static bool intel_pxp_session_is_in_play(struct intel_pxp *pxp, u32 id)static int pxp_wait_for_session_state (struct intel_pxp *pxp,u32 id,bool in_play) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 mask =BIT (id);int ret;
@@ -56,7 +56,7 @@ static int pxp_wait_for_session_state(struct intel_pxp *pxp, u32 id, bool in_plastatic int pxp_create_arb_session (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;int ret; pxp->arb_is_valid = false;
@@ -90,7 +90,7 @@ static int pxp_create_arb_session(struct intel_pxp *pxp)static int pxp_terminate_arb_session_and_global (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* must mark termination in progress calling this function */ GEM_WARN_ON (pxp->arb_is_valid);
@@ -141,7 +141,7 @@ static void pxp_terminate_complete(struct intel_pxp *pxp)static void pxp_session_work (struct work_struct *work) {struct intel_pxp *pxp =container_of (work,typeof (*pxp), session_work); -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;intel_wakeref_t wakeref;u32 events =0 ;
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +13 -18
@@ -11,25 +11,20 @@#include "gem/i915_gem_lmem.h" #include "i915_drv.h" +#include "intel_pxp.h" -#include "intel_pxp_session.h" -#include "intel_pxp_tee.h" #include "intel_pxp_cmd_interface_42.h" #include "intel_pxp_huc.h" - -static inline struct intel_pxp *i915_dev_to_pxp (struct device *i915_kdev) -{ -struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); - -return &to_gt (i915)->pxp; -} +#include "intel_pxp_session.h" +#include "intel_pxp_tee.h" +#include "intel_pxp_types.h" static int intel_pxp_tee_io_message (struct intel_pxp *pxp,void *msg_in,u32 msg_in_size,void *msg_out,u32 msg_out_max_size,u32 *msg_out_rcv_size) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;int ret =0 ;
@@ -79,7 +74,7 @@ int intel_pxp_tee_stream_message(struct intel_pxp *pxp, {/* TODO: for bigger objects we need to use a sg of 4k pages */ const size_t max_msg_size =PAGE_SIZE ; -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;unsigned int offset =0 ;struct scatterlist *sg;
@@ -127,8 +122,8 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); -struct intel_uc *uc = &pxp_to_gt (pxp)->uc; +struct intel_pxp *pxp = i915->pxp; +struct intel_uc *uc = &pxp->ctrl_gt->uc;intel_wakeref_t wakeref;int ret =0 ;
@@ -164,7 +159,7 @@ static void i915_pxp_tee_component_unbind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); +struct intel_pxp *pxp = i915->pxp;intel_wakeref_t wakeref;if (intel_pxp_is_enabled (pxp))
@@ -183,7 +178,7 @@ static const struct component_ops i915_pxp_tee_component_ops = {static int alloc_streaming_command (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct drm_i915_gem_object *obj =NULL ;void *cmd;int err;
@@ -244,7 +239,7 @@ static void free_streaming_command(struct intel_pxp *pxp)int intel_pxp_tee_component_init (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct drm_i915_private *i915 = gt->i915;mutex_init (&pxp->tee_mutex);
@@ -271,7 +266,7 @@ int intel_pxp_tee_component_init(struct intel_pxp *pxp)void intel_pxp_tee_component_fini (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;if (!pxp->pxp_component_added)return ;
@@ -285,7 +280,7 @@ void intel_pxp_tee_component_fini(struct intel_pxp *pxp)int intel_pxp_tee_cmd_create_arb_session (struct intel_pxp *pxp,int arb_session_id) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct pxp42_create_arb_in msg_in = {0 };struct pxp42_create_arb_out msg_out = {0 };int ret;
drivers/gpu/drm/i915/pxp/intel_pxp_types.h +8 -0
@@ -12,12 +12,20 @@#include <linux/workqueue.h> struct intel_context ; +struct intel_gt ;struct i915_pxp_component ; +struct drm_i915_private ;/** * struct intel_pxp - pxp state */ struct intel_pxp { +/** +* @ctrl_gt: poiner to the tile that owns the controls for PXP subsystem assets that +* the VDBOX, the KCR engine (and GSC CS depending on the platform) +*/ +struct intel_gt *ctrl_gt; +/** * @pxp_component: i915_pxp_component struct of the bound mei_pxp * module. Only set and cleared inside component bind/unbind functions,
base-commit: 886c7f9510ce20f099d27d9e7d9de32402c9e5e6
Signature · 1 line
2.34.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
== Series Details ==
== Series Details ==
Series: series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
URL : https://patchwork.freedesktop.org/series/111650/
State : warning
== Summary ==
Error: dim checkpatch failedc366ae879c50 drm/i915/pxp: Promote pxp subsystem to top-level of i915
-:114: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #114:
References: https://patchwork.freedesktop.org/patch/msgid/[email protected]
total: 0 errors, 1 warnings, 0 checks, 780 lines checked
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
In reply to Alan Previn== Series Details ==
== Series Details ==
Series: series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
URL : https://patchwork.freedesktop.org/series/111650/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12471 -> Patchwork_111650v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/index.html
Participating hosts (44 -> 29)
------------------------------
Missing (15): fi-kbl-soraka fi-rkl-11600 bat-kbl-2 bat-adls-5 fi-tgl-dsi bat-dg1-5 fi-bsw-n3050 bat-dg2-8 bat-adlp-9 bat-dg2-9 bat-adlp-6 bat-adlp-4 bat-jsl-3 bat-dg2-11 fi-bsw-nick
Known issues
------------
Here are the changes found in Patchwork_111650v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@gt_heartbeat:
- fi-cfl-8109u: [PASS][1] -> [DMESG-FAIL][2] ([i915#5334])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [DMESG-WARN][3] ([i915#2867]) -> [PASS][4] +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/bat-rplp-1/igt@gem_exec_suspend@[email protected]
* igt@i915_selftest@live@hangcheck:
- fi-adl-ddr5: [DMESG-WARN][5] ([i915#5591]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/fi-adl-ddr5/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/fi-adl-ddr5/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5591]: https://gitlab.freedesktop.org/drm/intel/issues/5591
Build changes
-------------
* Linux: CI_DRM_12471 -> Patchwork_111650v1
CI-20190529: 20190529
CI_DRM_12471: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7083: c001793d5f22deb01918b6ba52af829794582df1 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111650v1: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
f6c8c50321e3 drm/i915/pxp: Promote pxp subsystem to top-level of i915
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/index.html
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
In reply to Alan Previn== Series Details ==
== Series Details ==
Series: series starting with [v9,1/1] drm/i915/pxp: Promote pxp subsystem to top-level of i915
URL : https://patchwork.freedesktop.org/series/111650/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12471_full -> Patchwork_111650v1_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (9 -> 11)
------------------------------
Additional (2): shard-rkl shard-dg1
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_111650v1_full:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@perf_pmu@busy-idle-check-all@vcs0:
- {shard-dg1}: NOTRUN -> [FAIL][1] +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-dg1-15/igt@perf_pmu@[email protected]
Known issues
------------
Here are the changes found in Patchwork_111650v1_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_persistence@hang:
- shard-skl: NOTRUN -> [SKIP][2] ([fdo#109271]) +150 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl5/igt@[email protected]
* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][3] -> [FAIL][4] ([i915#2842])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb6/igt@gem_exec_fair@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-tglb7/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-apl: [PASS][5] -> [FAIL][6] ([i915#2842])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl3/igt@gem_exec_fair@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl6/igt@gem_exec_fair@[email protected]
* igt@gem_lmem_swapping@heavy-verify-multi-ccs:
- shard-skl: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#4613]) +2 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl2/igt@[email protected]
* igt@gem_lmem_swapping@heavy-verify-random:
- shard-apl: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#4613])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@[email protected]
* igt@i915_module_load@load:
- shard-skl: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#6227])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl2/igt@[email protected]
* igt@i915_pipe_stress@stress-xrgb8888-ytiled:
- shard-skl: NOTRUN -> [FAIL][10] ([i915#7036])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl7/igt@[email protected]
* igt@i915_pm_dc@dc6-dpms:
- shard-iclb: [PASS][11] -> [FAIL][12] ([i915#3989] / [i915#454])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb3/igt@[email protected]
* igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_mc_ccs:
- shard-skl: NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#3886]) +8 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl5/igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_mc_ccs.html
* igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc:
- shard-apl: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#3886])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_chamelium@hdmi-hpd-storm-disable:
- shard-apl: NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@[email protected]
* igt@kms_color_chamelium@ctm-max:
- shard-skl: NOTRUN -> [SKIP][16] ([fdo#109271] / [fdo#111827]) +9 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl7/igt@[email protected]
* igt@kms_content_protection@lic@pipe-a-dp-1:
- shard-apl: NOTRUN -> [TIMEOUT][17] ([i915#7173])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@kms_content_protection@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@b-edp1:
- shard-skl: [PASS][18] -> [FAIL][19] ([i915#79]) +1 similar issue
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl4/igt@kms_flip@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl9/igt@kms_flip@[email protected]
* igt@kms_flip@flip-vs-suspend@b-dp1:
- shard-apl: [PASS][20] -> [DMESG-WARN][21] ([i915#180])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl2/igt@kms_flip@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@kms_flip@[email protected]
* igt@kms_flip@plain-flip-fb-recreate-interruptible@a-edp1:
- shard-skl: [PASS][22] -> [FAIL][23] ([i915#2122])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl5/igt@kms_flip@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl4/igt@kms_flip@[email protected]
* igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode:
- shard-iclb: NOTRUN -> [SKIP][24] ([i915#2587] / [i915#2672]) +4 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb7/igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode.html
* igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-16bpp-4tile-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][25] ([i915#2672]) +6 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb3/igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-16bpp-4tile-upscaling@pipe-a-default-mode.html
* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-wc:
- shard-apl: NOTRUN -> [SKIP][26] ([fdo#109271]) +16 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-wc.html
* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area:
- shard-skl: NOTRUN -> [SKIP][27] ([fdo#109271] / [i915#658]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl10/igt@[email protected]
* igt@kms_psr@psr2_sprite_mmap_gtt:
- shard-iclb: [PASS][28] -> [SKIP][29] ([fdo#109441]) +2 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_gtt.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb1/igt@kms_psr@psr2_sprite_mmap_gtt.html
* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-skl: [PASS][30] -> [INCOMPLETE][31] ([i915#7404])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl1/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl1/igt@[email protected]
* igt@sysfs_clients@busy:
- shard-skl: NOTRUN -> [SKIP][32] ([fdo#109271] / [i915#2994]) +2 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl7/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_balancer@parallel-out-fence:
- shard-iclb: [SKIP][33] ([i915#4525]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb8/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb2/igt@[email protected]
* igt@gem_huc_copy@huc-copy:
- shard-tglb: [SKIP][35] ([i915#2190]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb7/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-tglb2/igt@[email protected]
* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [FAIL][37] ([i915#3989] / [i915#454]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb3/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb6/igt@[email protected]
* igt@kms_flip@flip-vs-suspend-interruptible@a-dp1:
- shard-apl: [DMESG-WARN][39] ([i915#180]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-apl2/igt@kms_flip@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-apl8/igt@kms_flip@[email protected]
* igt@kms_flip@plain-flip-ts-check@b-edp1:
- shard-skl: [FAIL][41] ([i915#2122]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl5/igt@kms_flip@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl10/igt@kms_flip@[email protected]
* igt@kms_psr@psr2_cursor_plane_onoff:
- shard-iclb: [SKIP][43] ([fdo#109441]) -> [PASS][44] +1 similar issue
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb6/igt@kms_psr@psr2_cursor_plane_onoff.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html
* igt@kms_psr_stress_test@flip-primary-invalidate-overlay:
- shard-tglb: [SKIP][45] ([i915#5519]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-tglb7/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-tglb2/igt@[email protected]
* igt@syncobj_timeline@wait-for-submit-delayed-submit:
- shard-skl: [DMESG-WARN][47] ([i915#1982]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-skl3/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-skl2/igt@[email protected]
#### Warnings ####
* igt@kms_psr2_sf@overlay-plane-move-continuous-exceed-fully-sf:
- shard-iclb: [SKIP][49] ([i915#658]) -> [SKIP][50] ([i915#2920])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb8/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb2/igt@[email protected]
* igt@kms_psr2_sf@overlay-plane-move-continuous-sf:
- shard-iclb: [SKIP][51] ([i915#2920]) -> [SKIP][52] ([i915#658])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb1/igt@[email protected]
* igt@kms_psr2_sf@plane-move-sf-dmg-area:
- shard-iclb: [SKIP][53] ([i915#2920]) -> [SKIP][54] ([fdo#111068] / [i915#658])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12471/shard-iclb2/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/shard-iclb1/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2433]: https://gitlab.freedesktop.org/drm/intel/issues/2433
[i915#2435]: https://gitlab.freedesktop.org/drm/intel/issues/2435
[i915#2436]: https://gitlab.freedesktop.org/drm/intel/issues/2436
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3936]: https://gitlab.freedesktop.org/drm/intel/issues/3936
[i915#3938]: https://gitlab.freedesktop.org/drm/intel/issues/3938
[i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
[i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#426]: https://gitlab.freedesktop.org/drm/intel/issues/426
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4391]: https://gitlab.freedesktop.org/drm/intel/issues/4391
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4854]: https://gitlab.freedesktop.org/drm/intel/issues/4854
[i915#4855]: https://gitlab.freedesktop.org/drm/intel/issues/4855
[i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4874]: https://gitlab.freedesktop.org/drm/intel/issues/4874
[i915#4877]: https://gitlab.freedesktop.org/drm/intel/issues/4877
[i915#4879]: https://gitlab.freedesktop.org/drm/intel/issues/4879
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
[i915#4884]: https://gitlab.freedesktop.org/drm/intel/issues/4884
[i915#4885]: https://gitlab.freedesktop.org/drm/intel/issues/4885
[i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
[i915#4991]: https://gitlab.freedesktop.org/drm/intel/issues/4991
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5519]: https://gitlab.freedesktop.org/drm/intel/issues/5519
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
[i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
[i915#6355]: https://gitlab.freedesktop.org/drm/intel/issues/6355
[i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6463]: https://gitlab.freedesktop.org/drm/intel/issues/6463
[i915#6493]: https://gitlab.freedesktop.org/drm/intel/issues/6493
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#7036]: https://gitlab.freedesktop.org/drm/intel/issues/7036
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7173]: https://gitlab.freedesktop.org/drm/intel/issues/7173
[i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
[i915#7276]: https://gitlab.freedesktop.org/drm/intel/issues/7276
[i915#7404]: https://gitlab.freedesktop.org/drm/intel/issues/7404
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7582]: https://gitlab.freedesktop.org/drm/intel/issues/7582
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
Build changes
-------------
* Linux: CI_DRM_12471 -> Patchwork_111650v1
CI-20190529: 20190529
CI_DRM_12471: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7083: c001793d5f22deb01918b6ba52af829794582df1 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111650v1: 7f8dc69dce0e934751fe31c01a6b6baa0c65bf23 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111650v1/index.html
Quoted 489 lines · Alan Previn
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_gtstructure while theintel_pxpstructure currently hangs off theintel_gtstructure.Keeping the
intel_pxpstructure within theintel_gtstructure makes some internal functionalities more straight forward but adds code complexity to code readibility and maintainibility to many external-to-pxp subsystems which may need to pick the correctintel_gtstructure. An example of this would be theintel_pxp_is_activeorintel_pxp_is_enabledfunctionality which should be viewed as a global level inquiry, not a per-gt inquiry.That said, this series promotes the
intel_pxpstructure into thedrm_i915_privatestructure 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->pxpis 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_suspendafterintel_uc_suspendbut now is beforei915_gem_suspend_latebut 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 duringsuspend_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:
v8: - Removepxp_to_gtmacro (Daniele).
- Fix a bug inpxp_get_ctrl_gtfor the case of MTL and we don't support GSC-FW on it. (Daniele).
- Leavei915->pxpas NULL if we dont support PXP and in line with that, do additional validity check oni915->pxpfor intel_pxp_is_supported/enabled/active (Daniele).
- Remove unncessary include header fromintel_gt_debugfs.cand checkdrm_minori915->drm.primary(Daniele).
- Other cosmetics / minor issues / more comments on suspend flow order change (Daniele).
v7: - Dropi915_dev_to_pxpand inintel_pxp_inituse 'i915->pxp'
through out instead of local variable newpxp. (Rodrigo)
- In the caseintel_pxp_finiis called during driver unload but after i915 loading failed without pxp being allocated, checki915->pxpbefore referencing it. (Alan)
v6: - RemoveHAS_PXPmacro and replace it withintel_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 frompxp->i915since we can usepxp->ctrl_gt->i915if we need it. (Rodrigo).
v5: - Switch from series to single patch (Rodrigo).
- change function name frompxp_get_kcr_owner_gttopxp_get_ctrl_gt.
- Fix CI BAT failure by removing redundant call tointel_pxp_finifrom driver-remove.
- NOTE: remaining open still persists on using ptr-to-ptr and back-ptr.
v4: - Instead of maintainingintel_pxpas anintel_gtstructure member
and creating a number of convoluted helpers that takes in i915 as input and redirects to the correctintel_gtor takes anyintel_gtand internally replaces with the correctintel_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_pxpto replace what wasintel_gtpxp_issupported as the newintel_pxp_is_supported_on_gtto 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 correctGT->PXPcontrol 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 theintel_pxpsuspend/resume
for similar refactoringReferences: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by Alan Previn <[email protected]>--- .../drm/i915/display/skl_universal_plane.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_create.c | 2 +- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 5 - drivers/gpu/drm/i915/gt/intel_gt_debugfs.c | 2 - drivers/gpu/drm/i915/gt/intel_gt_irq.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 8 -- drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 - drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c | 2 +- drivers/gpu/drm/i915/i915_driver.c | 18 ++++ drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 94 ++++++++++++++----- drivers/gpu/drm/i915/pxp/intel_pxp.h | 9 +- drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 8 +- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c | 47 +++++++--- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h | 4 +- drivers/gpu/drm/i915/pxp/intel_pxp_huc.c | 2 +- drivers/gpu/drm/i915/pxp/intel_pxp_irq.c | 16 ++-- drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 6 +- drivers/gpu/drm/i915/pxp/intel_pxp_session.c | 10 +- drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 31 +++--- drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 8 ++ 23 files changed, 184 insertions(+), 110 deletions(-)drivers/gpu/drm/i915/display/skl_universal_plane.c +1
-1@@ -1848,7 +1848,7 @@ static bool bo_has_valid_encryption(struct drm_i915_gem_object *obj) {struct drm_i915_private *i915 =to_i915 (obj->base.dev); -return intel_pxp_key_check (&to_gt (i915)->pxp, obj, false) ==0 ; +return intel_pxp_key_check (i915->pxp, obj, false) ==0 ; }static bool pxp_is_borked (struct drm_i915_gem_object *obj)drivers/gpu/drm/i915/gem/i915_gem_context.c +3
-3@@ -257,7 +257,7 @@ static int proto_context_set_protected(struct drm_i915_private *i915,if (!protected) { pc->uses_protected_content = false; - }else if (!intel_pxp_is_enabled (&to_gt (i915)->pxp)) { + }else if (!intel_pxp_is_enabled (i915->pxp)) { ret = -ENODEV ; }else if ((pc->user_flags &BIT (UCONTEXT_RECOVERABLE )) || !(pc->user_flags &BIT (UCONTEXT_BANNABLE ))) {@@ -271,8 +271,8 @@ static int proto_context_set_protected(struct drm_i915_private *i915,*/ pc->pxp_wakeref =intel_runtime_pm_get (&i915->runtime_pm); -if (!intel_pxp_is_active (&to_gt (i915)->pxp)) - ret =intel_pxp_start (&to_gt (i915)->pxp); +if (!intel_pxp_is_active (i915->pxp)) + ret =intel_pxp_start (i915->pxp); }return ret;drivers/gpu/drm/i915/gem/i915_gem_create.c +1
-1@@ -384,7 +384,7 @@ static int ext_set_protected(struct i915_user_extension __user *base, void *dataif (ext.flags)return -EINVAL ; -if (!intel_pxp_is_enabled (&to_gt (ext_data->i915)->pxp)) +if (!intel_pxp_is_enabled (ext_data->i915->pxp))return -ENODEV ; ext_data->flags |=I915_BO_PROTECTED ;drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1
-1@@ -869,7 +869,7 @@ static struct i915_vma *eb_lookup_vma(struct i915_execbuffer *eb, u32 handle)*/ if (i915_gem_context_uses_protected_content (eb->gem_context) &&i915_gem_object_is_protected (obj)) { - err =intel_pxp_key_check (&vm->gt->pxp, obj, true); + err =intel_pxp_key_check (eb->i915->pxp, obj, true);if (err) {i915_gem_object_put (obj);return ERR_PTR (err);drivers/gpu/drm/i915/gt/intel_gt.c +0
-5@@ -8,7 +8,6 @@#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" -#include "pxp/intel_pxp.h" #include "i915_drv.h" #include "i915_perf_oa_regs.h" @@ -762,8 +761,6 @@ int intel_gt_init(struct intel_gt *gt)intel_migrate_init (>->migrate, gt); -intel_pxp_init (>->pxp); - goto out_fw; err_gt:__intel_gt_disable (gt);@@ -803,8 +800,6 @@ void intel_gt_driver_unregister(struct intel_gt *gt)intel_rps_driver_unregister (>->rps);intel_gsc_fini (>->gsc); -intel_pxp_fini (>->pxp); -/* * Upon unregistering the device to prevent any new users, cancel * all in-flight requests so that we can quickly unbind the active drivers/gpu/drm/i915/gt/intel_gt_debugfs.c +0
-2@@ -12,7 +12,6 @@#include "intel_gt_mcr.h" #include "intel_gt_pm_debugfs.h" #include "intel_sseu_debugfs.h" -#include "pxp/intel_pxp_debugfs.h" #include "uc/intel_uc_debugfs.h" int intel_gt_debugfs_reset_show (struct intel_gt *gt,u64 *val)@@ -99,7 +98,6 @@ void intel_gt_debugfs_register(struct intel_gt *gt)intel_sseu_debugfs_register (gt, root);intel_uc_debugfs_register (>->uc, root); -intel_pxp_debugfs_register (>->pxp, root); } void intel_gt_debugfs_register_files(struct dentry *root,drivers/gpu/drm/i915/gt/intel_gt_irq.c +1
-1@@ -76,7 +76,7 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,return gen11_rps_irq_handler (&media_gt->rps, iir);if (instance ==OTHER_KCR_INSTANCE ) -return intel_pxp_irq_handler (>->pxp, iir); +return intel_pxp_irq_handler (gt->i915->pxp, iir);if (instance ==OTHER_GSC_INSTANCE )return intel_gsc_irq_handler (gt, iir);drivers/gpu/drm/i915/gt/intel_gt_pm.c +0
-8@@ -304,8 +304,6 @@ int intel_gt_resume(struct intel_gt *gt)intel_uc_resume (>->uc); -intel_pxp_resume (>->pxp); -user_forcewake (gt, false); out_fw:@@ -339,8 +337,6 @@ void intel_gt_suspend_prepare(struct intel_gt *gt) {user_forcewake (gt, true);wait_for_suspend (gt); - -intel_pxp_suspend_prepare (>->pxp); }static suspend_state_t pm_suspend_target (void )@@ -365,7 +361,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)GEM_BUG_ON (gt->awake);intel_uc_suspend (>->uc); -intel_pxp_suspend (>->pxp);/* * On disabling the device, we want to turn off HW access to memory @@ -393,7 +388,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)void intel_gt_runtime_suspend (struct intel_gt *gt) { -intel_pxp_runtime_suspend (>->pxp);intel_uc_runtime_suspend (>->uc);GT_TRACE (gt,"\n" );@@ -411,8 +405,6 @@ int intel_gt_runtime_resume(struct intel_gt *gt)if (ret)return ret; -intel_pxp_runtime_resume (>->pxp); -return 0 ; }drivers/gpu/drm/i915/gt/intel_gt_types.h +0
-3@@ -30,7 +30,6 @@#include "intel_rps_types.h" #include "intel_migrate_types.h" #include "intel_wakeref.h" -#include "pxp/intel_pxp_types.h" #include "intel_wopcm.h" struct drm_i915_private ;@@ -275,8 +274,6 @@ struct intel_gt {u8 wb_index;/* Only used on HAS_L3_CCS_READ() platforms */ } mocs; -struct intel_pxp pxp; -/* gt/gtN sysfs */ struct kobject sysfs_gt;drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c +1
-1@@ -32,7 +32,7 @@ int intel_huc_fw_load_and_auth_via_gsc(struct intel_huc *huc)GEM_WARN_ON (intel_uc_fw_is_loaded (&huc->fw)); - ret =intel_pxp_huc_load_and_auth (&huc_to_gt (huc)->pxp); + ret =intel_pxp_huc_load_and_auth (huc_to_gt (huc)->i915->pxp);if (ret)return ret;drivers/gpu/drm/i915/i915_driver.c +18
-0@@ -73,6 +73,8 @@#include "gt/intel_gt_pm.h" #include "gt/intel_rc6.h" +#include "pxp/intel_pxp.h" +#include "pxp/intel_pxp_debugfs.h" #include "pxp/intel_pxp_pm.h" #include "i915_file_private.h" @@ -759,6 +761,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)for_each_gt (gt, dev_priv, i)intel_gt_driver_register (gt); +intel_pxp_debugfs_register (dev_priv->pxp); +i915_hwmon_register (dev_priv);intel_display_driver_register (dev_priv);@@ -790,6 +794,8 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)intel_display_driver_unregister (dev_priv); +intel_pxp_fini (dev_priv); +for_each_gt (gt, dev_priv, i)intel_gt_driver_unregister (gt);@@ -933,6 +939,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_cleanup_modeset2; +intel_pxp_init (i915); + ret =intel_modeset_init (i915);if (ret) goto out_cleanup_gem;@@ -1168,6 +1176,8 @@ static int i915_drm_prepare(struct drm_device *dev) {struct drm_i915_private *i915 =to_i915 (dev); +intel_pxp_suspend_prepare (i915->pxp); +/* * NB intel_display_suspend() may issue new requests after we've * ostensibly marked the GPU as ready-to-sleep here. We need to @@ -1248,6 +1258,8 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)disable_rpm_wakeref_asserts (rpm); +intel_pxp_suspend (dev_priv->pxp); +i915_gem_suspend_late (dev_priv);for_each_gt (gt, dev_priv, i)@@ -1360,6 +1372,8 @@ static int i915_drm_resume(struct drm_device *dev)i915_gem_resume (dev_priv); +intel_pxp_resume (dev_priv->pxp); +intel_modeset_init_hw (dev_priv);intel_init_clock_gating (dev_priv);intel_hpd_init (dev_priv);@@ -1643,6 +1657,8 @@ static int intel_runtime_suspend(struct device *kdev)*/ i915_gem_runtime_suspend (dev_priv); +intel_pxp_runtime_suspend (dev_priv->pxp); +for_each_gt (gt, dev_priv, i)intel_gt_runtime_suspend (gt);@@ -1747,6 +1763,8 @@ static int intel_runtime_resume(struct device *kdev)for_each_gt (gt, dev_priv, i)intel_gt_runtime_resume (gt); +intel_pxp_runtime_resume (dev_priv->pxp); +/* * On VLV/CHV display interrupts are part of the display * power well, so hpd is reinitialized from there. For drivers/gpu/drm/i915/i915_drv.h +3
-4@@ -72,6 +72,7 @@ struct intel_encoder;struct intel_limit ;struct intel_overlay_error_state ;struct vlv_s0ix_state ; +struct intel_pxp ;#define I915_GEM_GPU_DOMAINS \ (I915_GEM_DOMAIN_RENDER | \@@ -364,6 +365,8 @@ struct drm_i915_private {struct file *mmap_singleton; } gem; +struct intel_pxp *pxp; +u8 pch_ssc_use;/* For i915gm/i945gm vblank irq workaround */ @@ -919,10 +922,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_GLOBAL_MOCS_REGISTERS (dev_priv) (INTEL_INFO(dev_priv)->has_global_mocs) -#define HAS_PXP (dev_priv) ((IS_ENABLED(CONFIG_DRM_I915_PXP) && \ - INTEL_INFO(dev_priv)->has_pxp) && \ - VDBOX_MASK(to_gt(dev_priv))) -#define HAS_GMCH (dev_priv) (INTEL_INFO(dev_priv)->display.has_gmch)#define HAS_GMD_ID (i915) (INTEL_INFO(i915)->has_gmd_id)drivers/gpu/drm/i915/pxp/intel_pxp.c +9
-3@@ -3,13 +3,19 @@* Copyright(c) 2020 Intel Corporation. */ #include <linux/workqueue.h> + +#include "gem/i915_gem_context.h" + +#include "gt/intel_context.h" +#include "gt/intel_gt.h" + +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_irq.h" #include "intel_pxp_session.h" #include "intel_pxp_tee.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_context.h" -#include "i915_drv.h" +#include "intel_pxp_types.h" /** * DOC: PXP @@ -39,18 +45,26 @@* performed via the mei_pxp component module.
drivers/gpu/drm/i915/pxp/intel_pxp.c line 53
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-2*/ -struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false;
nit: this could be squashed in a single line:
if (!IS_ENABLED(CONFIG_DRM_I915_PXP) || !pxp)
not a blocker
drivers/gpu/drm/i915/pxp/intel_pxp.c line 61
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-0+return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt)); }bool intel_pxp_is_enabled (const struct intel_pxp *pxp) { +if (!pxp) +return false;return pxp->ce;
nit: this can be squashed as:
return pxp && pxp->ce;
same for the is_active below. not a blocker
Quoted 38 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +7
-4}bool intel_pxp_is_active (const struct intel_pxp *pxp) { +if (!pxp) +return false;return pxp->arb_is_valid; }@@ -74,7 +88,7 @@ static void kcr_pxp_disable(struct intel_gt *gt)static int create_vcs_context (struct intel_pxp *pxp) {static struct lock_class_key pxp_lock; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct intel_engine_cs *engine;struct intel_context *ce;int i;@@ -109,7 +123,7 @@ static void destroy_vcs_context(struct intel_pxp *pxp)static void pxp_init_full (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;int ret;/* @@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); } -void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 166
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +7
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ; +for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */
This comment doesn't really explain why we exclude the case with media_gt. I would have preferred a line to explain that the module only works for pre-media_gt platforms. not a blocker.
Quoted 258 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +39
-12+if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; + +return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{ + i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915); +if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. */ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp); + +return 0 ; } -void intel_pxp_fini (struct intel_pxp *pxp) +void intel_pxp_fini (struct drm_i915_private *i915) { - pxp->arb_is_valid = false; +if (!i915->pxp) +return ; -intel_pxp_tee_component_fini (pxp); + i915->pxp->arb_is_valid = false; -destroy_vcs_context (pxp); +intel_pxp_tee_component_fini (i915->pxp); + +destroy_vcs_context (i915->pxp); + +kfree (i915->pxp); + i915->pxp =NULL ; }void intel_pxp_mark_termination_in_progress (struct intel_pxp *pxp)@@ -173,7 +219,7 @@ void intel_pxp_mark_termination_in_progress(struct intel_pxp *pxp)static void pxp_queue_termination (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* * We want to get the same effect as if we received a termination @@ -238,13 +284,13 @@ int intel_pxp_start(struct intel_pxp *pxp)void intel_pxp_init_hw (struct intel_pxp *pxp) { -kcr_pxp_enable (pxp_to_gt (pxp)); +kcr_pxp_enable (pxp->ctrl_gt);intel_pxp_irq_enable (pxp); }void intel_pxp_fini_hw (struct intel_pxp *pxp) { -kcr_pxp_disable (pxp_to_gt (pxp)); +kcr_pxp_disable (pxp->ctrl_gt);intel_pxp_irq_disable (pxp); }@@ -278,7 +324,7 @@ int intel_pxp_key_check(struct intel_pxp *pxp,void intel_pxp_invalidate (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_gem_context *ctx, *cn;/* ban all contexts marked as protected */ drivers/gpu/drm/i915/pxp/intel_pxp.h +5
-4@@ -9,15 +9,16 @@#include <linux/errno.h> #include <linux/types.h> -struct intel_pxp ;struct drm_i915_gem_object ; +struct drm_i915_private ; +struct intel_pxp ; -struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp); +bool intel_pxp_is_supported (const struct intel_pxp *pxp);bool intel_pxp_is_enabled (const struct intel_pxp *pxp);bool intel_pxp_is_active (const struct intel_pxp *pxp); -void intel_pxp_init (struct intel_pxp *pxp); -void intel_pxp_fini (struct intel_pxp *pxp); +int intel_pxp_init (struct drm_i915_private *i915); +void intel_pxp_fini (struct drm_i915_private *i915);void intel_pxp_init_hw (struct intel_pxp *pxp);void intel_pxp_fini_hw (struct intel_pxp *pxp);drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c +5
-3@@ -3,9 +3,6 @@* Copyright(c) 2020, Intel Corporation. All rights reserved. */ -#include "intel_pxp.h" -#include "intel_pxp_cmd.h" -#include "intel_pxp_session.h" #include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gpu_commands.h" @@ -13,6 +10,11 @@#include "i915_trace.h" +#include "intel_pxp.h" +#include "intel_pxp_cmd.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" +/* stall until prior PXP and MFX/HCP/HUC objects are cmopleted */ #define MFX_WAIT_PXP (MFX_WAIT | \ MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | \drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +32
-15@@ -9,18 +9,20 @@#include <drm/drm_print.h> #include "gt/intel_gt_debugfs.h" +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_debugfs.h" #include "intel_pxp_irq.h" +#include "intel_pxp_types.h" static int pxp_info_show (struct seq_file *m,void *data) {struct intel_pxp *pxp = m->private;struct drm_printer p =drm_seq_file_printer (m); -bool enabled =intel_pxp_is_enabled (pxp); -if (!enabled) { +if (!intel_pxp_is_enabled (pxp)) {drm_printf (&p,"pxp disabled\n" );return 0 ; }@@ -30,7 +32,19 @@ static int pxp_info_show(struct seq_file *m, void *data)return 0 ; } -DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE (pxp_info); + +static int pxp_info_open (struct inode *inode,struct file *file) +{ +return single_open (file, pxp_info_show, inode->i_private); +} + +static const struct file_operations pxp_info_fops = { + .owner =THIS_MODULE , + .open = pxp_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};static int pxp_terminate_get (void *data,u64 *val) {@@ -41,7 +55,7 @@ static int pxp_terminate_get(void *data, u64 *val)static int pxp_terminate_set (void *data,u64 val) {struct intel_pxp *pxp = data; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;if (!intel_pxp_is_active (pxp))return -ENODEV ;@@ -59,23 +73,26 @@ static int pxp_terminate_set(void *data, u64 val) }DEFINE_SIMPLE_ATTRIBUTE (pxp_terminate_fops, pxp_terminate_get, pxp_terminate_set,"%llx\n" ); -void intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *gt_root) + +void intel_pxp_debugfs_register (struct intel_pxp *pxp) { -static const struct intel_gt_debugfs_file files[] = { - {"info" , &pxp_info_fops,NULL }, - {"terminate_state" , &pxp_terminate_fops,NULL }, - }; -struct dentry *root; +struct drm_minor *minor; +struct dentry *pxproot; -if (!gt_root) +if (!intel_pxp_is_supported (pxp))return ; -if (!HAS_PXP ((pxp_to_gt (pxp)->i915))) + minor = pxp->ctrl_gt->i915->drm.primary; +if (!minor->debugfs_root)return ; - root =debugfs_create_dir ("pxp" , gt_root); -if (IS_ERR (root)) + pxproot =debugfs_create_dir ("pxp" , minor->debugfs_root); +if (IS_ERR (pxproot))return ; -intel_gt_debugfs_register_files (root, files,ARRAY_SIZE (files), pxp); +debugfs_create_file ("info" ,0444 , pxproot, + pxp, &pxp_info_fops); + +debugfs_create_file ("terminate_state" ,0644 , pxproot, + pxp, &pxp_terminate_fops); }drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h +2
-2@@ -10,10 +10,10 @@ struct intel_pxp;struct dentry ;#ifdef CONFIG_DRM_I915_PXP -void intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root); +void intel_pxp_debugfs_register (struct intel_pxp *pxp);#else static inline void -intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root) +intel_pxp_debugfs_register (struct intel_pxp *pxp) { }#endif drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +0
-0
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c line 21
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +1
-1@@ -18,7 +18,7 @@int intel_pxp_huc_load_and_auth (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;
This is called from outside the PXP code, so we need to check the pxp pointer before de-referencing it (see also pxp->pxp_component further down this function). It does look like the stack it's kind of circular so it should be safe (pxp bind -> huc load -> this function), but IMO better stick to the rule that all functions called from outside need a check.
With this fixed:
Quoted 260 lines
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +0
-0struct intel_huc *huc = >->uc.huc;struct pxp43_start_huc_auth_in huc_in = {0 };struct pxp43_start_huc_auth_out huc_out = {0 };drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +10
-6@@ -3,14 +3,18 @@* Copyright(c) 2020 Intel Corporation. */ #include <linux/workqueue.h> -#include "intel_pxp.h" -#include "intel_pxp_irq.h" -#include "intel_pxp_session.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_regs.h" #include "gt/intel_gt_types.h" +#include "i915_irq.h" #include "i915_reg.h" + +#include "intel_pxp.h" +#include "intel_pxp_irq.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" #include "intel_runtime_pm.h" /** @@ -20,7 +24,7 @@*/ void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;if (GEM_WARN_ON (!intel_pxp_is_enabled (pxp)))return ;@@ -62,7 +66,7 @@ static inline void pxp_irq_reset(struct intel_gt *gt)void intel_pxp_irq_enable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;spin_lock_irq (gt->irq_lock);@@ -77,7 +81,7 @@ void intel_pxp_irq_enable(struct intel_pxp *pxp)void intel_pxp_irq_disable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* * We always need to submit a global termination when we re-enable the drivers/gpu/drm/i915/pxp/intel_pxp_pm.c +4
-2@@ -3,11 +3,13 @@* Copyright(c) 2020 Intel Corporation. */ +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_irq.h" #include "intel_pxp_pm.h" #include "intel_pxp_session.h" -#include "i915_drv.h" +#include "intel_pxp_types.h" void intel_pxp_suspend_prepare (struct intel_pxp *pxp) {@@ -26,7 +28,7 @@ void intel_pxp_suspend(struct intel_pxp *pxp)if (!intel_pxp_is_enabled (pxp))return ; - with_intel_runtime_pm(&pxp_to_gt(pxp)->i915->runtime_pm, wakeref) { + with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref) {intel_pxp_fini_hw (pxp); pxp->hw_state_invalidated = false; }drivers/gpu/drm/i915/pxp/intel_pxp_session.c +5
-5@@ -20,7 +20,7 @@static bool intel_pxp_session_is_in_play (struct intel_pxp *pxp,u32 id) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 sip =0 ;@@ -33,7 +33,7 @@ static bool intel_pxp_session_is_in_play(struct intel_pxp *pxp, u32 id)static int pxp_wait_for_session_state (struct intel_pxp *pxp,u32 id,bool in_play) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 mask =BIT (id);int ret;@@ -56,7 +56,7 @@ static int pxp_wait_for_session_state(struct intel_pxp *pxp, u32 id, bool in_plastatic int pxp_create_arb_session (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;int ret; pxp->arb_is_valid = false;@@ -90,7 +90,7 @@ static int pxp_create_arb_session(struct intel_pxp *pxp)static int pxp_terminate_arb_session_and_global (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* must mark termination in progress calling this function */ GEM_WARN_ON (pxp->arb_is_valid);@@ -141,7 +141,7 @@ static void pxp_terminate_complete(struct intel_pxp *pxp)static void pxp_session_work (struct work_struct *work) {struct intel_pxp *pxp =container_of (work,typeof (*pxp), session_work); -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;intel_wakeref_t wakeref;u32 events =0 ;drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +13
-18@@ -11,25 +11,20 @@#include "gem/i915_gem_lmem.h" #include "i915_drv.h" +#include "intel_pxp.h" -#include "intel_pxp_session.h" -#include "intel_pxp_tee.h" #include "intel_pxp_cmd_interface_42.h" #include "intel_pxp_huc.h" - -static inline struct intel_pxp *i915_dev_to_pxp (struct device *i915_kdev) -{ -struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); - -return &to_gt (i915)->pxp; -} +#include "intel_pxp_session.h" +#include "intel_pxp_tee.h" +#include "intel_pxp_types.h" static int intel_pxp_tee_io_message (struct intel_pxp *pxp,void *msg_in,u32 msg_in_size,void *msg_out,u32 msg_out_max_size,u32 *msg_out_rcv_size) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;int ret =0 ;@@ -79,7 +74,7 @@ int intel_pxp_tee_stream_message(struct intel_pxp *pxp, {/* TODO: for bigger objects we need to use a sg of 4k pages */ const size_t max_msg_size =PAGE_SIZE ; -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;unsigned int offset =0 ;struct scatterlist *sg;@@ -127,8 +122,8 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); -struct intel_uc *uc = &pxp_to_gt (pxp)->uc; +struct intel_pxp *pxp = i915->pxp; +struct intel_uc *uc = &pxp->ctrl_gt->uc;intel_wakeref_t wakeref;int ret =0 ;@@ -164,7 +159,7 @@ static void i915_pxp_tee_component_unbind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); +struct intel_pxp *pxp = i915->pxp;intel_wakeref_t wakeref;if (intel_pxp_is_enabled (pxp))@@ -183,7 +178,7 @@ static const struct component_ops i915_pxp_tee_component_ops = {static int alloc_streaming_command (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct drm_i915_gem_object *obj =NULL ;void *cmd;int err;@@ -244,7 +239,7 @@ static void free_streaming_command(struct intel_pxp *pxp)int intel_pxp_tee_component_init (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct drm_i915_private *i915 = gt->i915;mutex_init (&pxp->tee_mutex);@@ -271,7 +266,7 @@ int intel_pxp_tee_component_init(struct intel_pxp *pxp)void intel_pxp_tee_component_fini (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;if (!pxp->pxp_component_added)return ;@@ -285,7 +280,7 @@ void intel_pxp_tee_component_fini(struct intel_pxp *pxp)int intel_pxp_tee_cmd_create_arb_session (struct intel_pxp *pxp,int arb_session_id) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct pxp42_create_arb_in msg_in = {0 };struct pxp42_create_arb_out msg_out = {0 };int ret;drivers/gpu/drm/i915/pxp/intel_pxp_types.h +8
-0@@ -12,12 +12,20 @@#include <linux/workqueue.h> struct intel_context ; +struct intel_gt ;struct i915_pxp_component ; +struct drm_i915_private ;/** * struct intel_pxp - pxp state */ struct intel_pxp { +/** +* @ctrl_gt: poiner to the tile that owns the controls for PXP subsystem assets that +* the VDBOX, the KCR engine (and GSC CS depending on the platform) +*/ +struct intel_gt *ctrl_gt; +/** * @pxp_component: i915_pxp_component struct of the bound mei_pxp * module. Only set and cleared inside component bind/unbind functions, base-commit:
886c7f9510ce20f099d27d9e7d9de32402c9e5e6
Quoted 2 lines · Daniele
On 12/5/2022 4:03 PM, Alan Previn wrote:
Alan:[snip]
Quoted 36 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 53
Quoted 12 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-2@@ -39,18 +45,26 @@* performed via the mei_pxp component module. */ -struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false;nit: this could be squashed in a single line:
if (!IS_ENABLED(CONFIG_DRM_I915_PXP) || !pxp)
not a blocker
drivers/gpu/drm/i915/pxp/intel_pxp.c line 61
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-0+return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt)); }bool intel_pxp_is_enabled (const struct intel_pxp *pxp) { +if (!pxp) +return false;return pxp->ce;nit: this can be squashed as:
return pxp &&
pxp->ce;same for the
is_activebelow. not a blockerQuoted 2 lines
(quoted diff) +0
-0}
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 70
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-0bool intel_pxp_is_active (const struct intel_pxp *pxp) { +if (!pxp) +return false;return pxp->arb_is_valid; }
Alan: okay - will handle some of these nits since i need to re-rev anyway Alan:[snip]
Quoted 6 lines
This comment doesn't really explain why we exclude the case with
media_gt. I would have preferred a line to explain that the module only works for pre-media_gt platforms. not a blocker.
Alan: Okay will add a comment.
Alan:[snip]
Quoted 14 lines
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c line 21
Quoted 6 lines
drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +1
-1@@ -18,7 +18,7 @@int intel_pxp_huc_load_and_auth (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;This is called from outside the PXP code, so we need to check the pxp pointer before de-referencing it (see also
pxp->pxp_componentfurther down this function). It does look like the stack it's kind of circular so it should be safe (pxp bind -> huc load -> this function), but IMO better stick to the rule that all functions called from outside need a check.
Quoted 4 lines
With this fixed:
Reviewed-by Daniele Ceraolo Spurio <[email protected]>
Alan:Thanks will do - will respin rev10
Alan:[snip]
Quoted 55 lines · Alan Previn
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_gtstructure while theintel_pxpstructure currently hangs off theintel_gtstructure.Keeping the
intel_pxpstructure within theintel_gtstructure makes some internal functionalities more straight forward but adds code complexity to code readibility and maintainibility to many external-to-pxp subsystems which may need to pick the correctintel_gtstructure. An example of this would be theintel_pxp_is_activeorintel_pxp_is_enabledfunctionality which should be viewed as a global level inquiry, not a per-gt inquiry.That said, this series promotes the
intel_pxpstructure into thedrm_i915_privatestructure 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->pxpis 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_suspendafterintel_uc_suspendbut now is beforei915_gem_suspend_latebut 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 duringsuspend_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).
Quoted 2 lines
Changes from prior revs:
v8: - Removepxp_to_gtmacro (Daniele).
Okay I guess, conceptually, just a pity since it would have made the diff smaller if kept.
Quoted 433 lines
- Fix a bug in
pxp_get_ctrl_gtfor the case of MTL and we don't support GSC-FW on it. (Daniele).
- Leavei915->pxpas NULL if we dont support PXP and in line with that, do additional validity check oni915->pxpfor intel_pxp_is_supported/enabled/active (Daniele).
- Remove unncessary include header fromintel_gt_debugfs.cand checkdrm_minori915->drm.primary(Daniele).
- Other cosmetics / minor issues / more comments on suspend flow order change (Daniele).
v7: - Dropi915_dev_to_pxpand inintel_pxp_inituse 'i915->pxp'
through out instead of local variable newpxp. (Rodrigo)
- In the caseintel_pxp_finiis called during driver unload but after i915 loading failed without pxp being allocated, checki915->pxpbefore referencing it. (Alan)
v6: - RemoveHAS_PXPmacro and replace it withintel_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 frompxp->i915since we can usepxp->ctrl_gt->i915if we need it. (Rodrigo).
v5: - Switch from series to single patch (Rodrigo).
- change function name frompxp_get_kcr_owner_gttopxp_get_ctrl_gt.
- Fix CI BAT failure by removing redundant call tointel_pxp_finifrom driver-remove.
- NOTE: remaining open still persists on using ptr-to-ptr and back-ptr.
v4: - Instead of maintainingintel_pxpas anintel_gtstructure member
and creating a number of convoluted helpers that takes in i915 as input and redirects to the correctintel_gtor takes anyintel_gtand internally replaces with the correctintel_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_pxpto replace what wasintel_gtpxp_issupported as the newintel_pxp_is_supported_on_gtto 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 correctGT->PXPcontrol 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 theintel_pxpsuspend/resume
for similar refactoringReferences: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by Alan Previn <[email protected]>--- .../drm/i915/display/skl_universal_plane.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_create.c | 2 +- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 5 - drivers/gpu/drm/i915/gt/intel_gt_debugfs.c | 2 - drivers/gpu/drm/i915/gt/intel_gt_irq.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 8 -- drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 - drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c | 2 +- drivers/gpu/drm/i915/i915_driver.c | 18 ++++ drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 94 ++++++++++++++----- drivers/gpu/drm/i915/pxp/intel_pxp.h | 9 +- drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 8 +- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c | 47 +++++++--- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h | 4 +- drivers/gpu/drm/i915/pxp/intel_pxp_huc.c | 2 +- drivers/gpu/drm/i915/pxp/intel_pxp_irq.c | 16 ++-- drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 6 +- drivers/gpu/drm/i915/pxp/intel_pxp_session.c | 10 +- drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 31 +++--- drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 8 ++ 23 files changed, 184 insertions(+), 110 deletions(-)drivers/gpu/drm/i915/display/skl_universal_plane.c +1
-1@@ -1848,7 +1848,7 @@ static bool bo_has_valid_encryption(struct drm_i915_gem_object *obj) {struct drm_i915_private *i915 =to_i915 (obj->base.dev); -return intel_pxp_key_check (&to_gt (i915)->pxp, obj, false) ==0 ; +return intel_pxp_key_check (i915->pxp, obj, false) ==0 ; }static bool pxp_is_borked (struct drm_i915_gem_object *obj)drivers/gpu/drm/i915/gem/i915_gem_context.c +3
-3@@ -257,7 +257,7 @@ static int proto_context_set_protected(struct drm_i915_private *i915,if (!protected) { pc->uses_protected_content = false; - }else if (!intel_pxp_is_enabled (&to_gt (i915)->pxp)) { + }else if (!intel_pxp_is_enabled (i915->pxp)) { ret = -ENODEV ; }else if ((pc->user_flags &BIT (UCONTEXT_RECOVERABLE )) || !(pc->user_flags &BIT (UCONTEXT_BANNABLE ))) {@@ -271,8 +271,8 @@ static int proto_context_set_protected(struct drm_i915_private *i915,*/ pc->pxp_wakeref =intel_runtime_pm_get (&i915->runtime_pm); -if (!intel_pxp_is_active (&to_gt (i915)->pxp)) - ret =intel_pxp_start (&to_gt (i915)->pxp); +if (!intel_pxp_is_active (i915->pxp)) + ret =intel_pxp_start (i915->pxp); }return ret;drivers/gpu/drm/i915/gem/i915_gem_create.c +1
-1@@ -384,7 +384,7 @@ static int ext_set_protected(struct i915_user_extension __user *base, void *dataif (ext.flags)return -EINVAL ; -if (!intel_pxp_is_enabled (&to_gt (ext_data->i915)->pxp)) +if (!intel_pxp_is_enabled (ext_data->i915->pxp))return -ENODEV ; ext_data->flags |=I915_BO_PROTECTED ;drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1
-1@@ -869,7 +869,7 @@ static struct i915_vma *eb_lookup_vma(struct i915_execbuffer *eb, u32 handle)*/ if (i915_gem_context_uses_protected_content (eb->gem_context) &&i915_gem_object_is_protected (obj)) { - err =intel_pxp_key_check (&vm->gt->pxp, obj, true); + err =intel_pxp_key_check (eb->i915->pxp, obj, true);if (err) {i915_gem_object_put (obj);return ERR_PTR (err);drivers/gpu/drm/i915/gt/intel_gt.c +0
-5@@ -8,7 +8,6 @@#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" -#include "pxp/intel_pxp.h" #include "i915_drv.h" #include "i915_perf_oa_regs.h" @@ -762,8 +761,6 @@ int intel_gt_init(struct intel_gt *gt)intel_migrate_init (>->migrate, gt); -intel_pxp_init (>->pxp); - goto out_fw; err_gt:__intel_gt_disable (gt);@@ -803,8 +800,6 @@ void intel_gt_driver_unregister(struct intel_gt *gt)intel_rps_driver_unregister (>->rps);intel_gsc_fini (>->gsc); -intel_pxp_fini (>->pxp); -/* * Upon unregistering the device to prevent any new users, cancel * all in-flight requests so that we can quickly unbind the active drivers/gpu/drm/i915/gt/intel_gt_debugfs.c +0
-2@@ -12,7 +12,6 @@#include "intel_gt_mcr.h" #include "intel_gt_pm_debugfs.h" #include "intel_sseu_debugfs.h" -#include "pxp/intel_pxp_debugfs.h" #include "uc/intel_uc_debugfs.h" int intel_gt_debugfs_reset_show (struct intel_gt *gt,u64 *val)@@ -99,7 +98,6 @@ void intel_gt_debugfs_register(struct intel_gt *gt)intel_sseu_debugfs_register (gt, root);intel_uc_debugfs_register (>->uc, root); -intel_pxp_debugfs_register (>->pxp, root); } void intel_gt_debugfs_register_files(struct dentry *root,drivers/gpu/drm/i915/gt/intel_gt_irq.c +1
-1@@ -76,7 +76,7 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,return gen11_rps_irq_handler (&media_gt->rps, iir);if (instance ==OTHER_KCR_INSTANCE ) -return intel_pxp_irq_handler (>->pxp, iir); +return intel_pxp_irq_handler (gt->i915->pxp, iir);if (instance ==OTHER_GSC_INSTANCE )return intel_gsc_irq_handler (gt, iir);drivers/gpu/drm/i915/gt/intel_gt_pm.c +0
-8@@ -304,8 +304,6 @@ int intel_gt_resume(struct intel_gt *gt)intel_uc_resume (>->uc); -intel_pxp_resume (>->pxp); -user_forcewake (gt, false); out_fw:@@ -339,8 +337,6 @@ void intel_gt_suspend_prepare(struct intel_gt *gt) {user_forcewake (gt, true);wait_for_suspend (gt); - -intel_pxp_suspend_prepare (>->pxp); }static suspend_state_t pm_suspend_target (void )@@ -365,7 +361,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)GEM_BUG_ON (gt->awake);intel_uc_suspend (>->uc); -intel_pxp_suspend (>->pxp);/* * On disabling the device, we want to turn off HW access to memory @@ -393,7 +388,6 @@ void intel_gt_suspend_late(struct intel_gt *gt)void intel_gt_runtime_suspend (struct intel_gt *gt) { -intel_pxp_runtime_suspend (>->pxp);intel_uc_runtime_suspend (>->uc);GT_TRACE (gt,"\n" );@@ -411,8 +405,6 @@ int intel_gt_runtime_resume(struct intel_gt *gt)if (ret)return ret; -intel_pxp_runtime_resume (>->pxp); -return 0 ; }drivers/gpu/drm/i915/gt/intel_gt_types.h +0
-3@@ -30,7 +30,6 @@#include "intel_rps_types.h" #include "intel_migrate_types.h" #include "intel_wakeref.h" -#include "pxp/intel_pxp_types.h" #include "intel_wopcm.h" struct drm_i915_private ;@@ -275,8 +274,6 @@ struct intel_gt {u8 wb_index;/* Only used on HAS_L3_CCS_READ() platforms */ } mocs; -struct intel_pxp pxp; -/* gt/gtN sysfs */ struct kobject sysfs_gt;drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c +1
-1@@ -32,7 +32,7 @@ int intel_huc_fw_load_and_auth_via_gsc(struct intel_huc *huc)GEM_WARN_ON (intel_uc_fw_is_loaded (&huc->fw)); - ret =intel_pxp_huc_load_and_auth (&huc_to_gt (huc)->pxp); + ret =intel_pxp_huc_load_and_auth (huc_to_gt (huc)->i915->pxp);if (ret)return ret;drivers/gpu/drm/i915/i915_driver.c +18
-0@@ -73,6 +73,8 @@#include "gt/intel_gt_pm.h" #include "gt/intel_rc6.h" +#include "pxp/intel_pxp.h" +#include "pxp/intel_pxp_debugfs.h" #include "pxp/intel_pxp_pm.h" #include "i915_file_private.h" @@ -759,6 +761,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)for_each_gt (gt, dev_priv, i)intel_gt_driver_register (gt); +intel_pxp_debugfs_register (dev_priv->pxp); +i915_hwmon_register (dev_priv);intel_display_driver_register (dev_priv);@@ -790,6 +794,8 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)intel_display_driver_unregister (dev_priv); +intel_pxp_fini (dev_priv); +for_each_gt (gt, dev_priv, i)intel_gt_driver_unregister (gt);@@ -933,6 +939,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_cleanup_modeset2; +intel_pxp_init (i915); + ret =intel_modeset_init (i915);if (ret) goto out_cleanup_gem;@@ -1168,6 +1176,8 @@ static int i915_drm_prepare(struct drm_device *dev) {struct drm_i915_private *i915 =to_i915 (dev); +intel_pxp_suspend_prepare (i915->pxp); +/* * NB intel_display_suspend() may issue new requests after we've * ostensibly marked the GPU as ready-to-sleep here. We need to @@ -1248,6 +1258,8 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)disable_rpm_wakeref_asserts (rpm); +intel_pxp_suspend (dev_priv->pxp); +i915_gem_suspend_late (dev_priv);for_each_gt (gt, dev_priv, i)@@ -1360,6 +1372,8 @@ static int i915_drm_resume(struct drm_device *dev)i915_gem_resume (dev_priv); +intel_pxp_resume (dev_priv->pxp); +intel_modeset_init_hw (dev_priv);intel_init_clock_gating (dev_priv);intel_hpd_init (dev_priv);@@ -1643,6 +1657,8 @@ static int intel_runtime_suspend(struct device *kdev)*/ i915_gem_runtime_suspend (dev_priv); +intel_pxp_runtime_suspend (dev_priv->pxp); +for_each_gt (gt, dev_priv, i)intel_gt_runtime_suspend (gt);@@ -1747,6 +1763,8 @@ static int intel_runtime_resume(struct device *kdev)for_each_gt (gt, dev_priv, i)intel_gt_runtime_resume (gt); +intel_pxp_runtime_resume (dev_priv->pxp); +/* * On VLV/CHV display interrupts are part of the display * power well, so hpd is reinitialized from there. For drivers/gpu/drm/i915/i915_drv.h +3
-4@@ -72,6 +72,7 @@ struct intel_encoder;struct intel_limit ;struct intel_overlay_error_state ;struct vlv_s0ix_state ; +struct intel_pxp ;#define I915_GEM_GPU_DOMAINS \ (I915_GEM_DOMAIN_RENDER | \@@ -364,6 +365,8 @@ struct drm_i915_private {struct file *mmap_singleton; } gem; +struct intel_pxp *pxp; +u8 pch_ssc_use;/* For i915gm/i945gm vblank irq workaround */ @@ -919,10 +922,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_GLOBAL_MOCS_REGISTERS (dev_priv) (INTEL_INFO(dev_priv)->has_global_mocs) -#define HAS_PXP (dev_priv) ((IS_ENABLED(CONFIG_DRM_I915_PXP) && \ - INTEL_INFO(dev_priv)->has_pxp) && \ - VDBOX_MASK(to_gt(dev_priv))) -#define HAS_GMCH (dev_priv) (INTEL_INFO(dev_priv)->display.has_gmch)#define HAS_GMD_ID (i915) (INTEL_INFO(i915)->has_gmd_id)drivers/gpu/drm/i915/pxp/intel_pxp.c +9
-3@@ -3,13 +3,19 @@* Copyright(c) 2020 Intel Corporation. */ #include <linux/workqueue.h> + +#include "gem/i915_gem_context.h" + +#include "gt/intel_context.h" +#include "gt/intel_gt.h" + +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_irq.h" #include "intel_pxp_session.h" #include "intel_pxp_tee.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_context.h" -#include "i915_drv.h" +#include "intel_pxp_types.h" /** * DOC: PXP @@ -39,18 +45,26 @@* performed via the mei_pxp component module. */
drivers/gpu/drm/i915/pxp/intel_pxp.c line 54
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-2-struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false; +return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt));
Intel_pxp_is_supported operating on the pxp reads a bit funny when one of the checks is for NULL passed in object to start with.
And all callers pass in i915->pxp so my immediate thought is whether i915_pxp_is_supported(i915) was considered?
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0}bool intel_pxp_is_enabled (const struct intel_pxp *pxp) {
drivers/gpu/drm/i915/pxp/intel_pxp.c line 68
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +4
-0+if (!pxp) +return false;return pxp->ce; }bool intel_pxp_is_active (const struct intel_pxp *pxp) { +if (!pxp) +return false;return pxp->arb_is_valid;
Ditto.
Quoted 21 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-2}@@ -74,7 +88,7 @@ static void kcr_pxp_disable(struct intel_gt *gt)static int create_vcs_context (struct intel_pxp *pxp) {static struct lock_class_key pxp_lock; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct intel_engine_cs *engine;struct intel_context *ce;int i;@@ -109,7 +123,7 @@ static void destroy_vcs_context(struct intel_pxp *pxp)static void pxp_init_full (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;int ret;/*
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 158
Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-2@@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); } -void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;
No need to init.
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ;
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 169
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */ +if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; +
None of this makes sense unless CONFIG_DRM_I915_PXP, right?
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-0+return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 184
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+ i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915); +if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }
If you store ctrl_gt in a local then you don't have to allocate until you'll know you need it, however..
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel.
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 194
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-4*/ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp);
... intel_pxp_is_supported() returnsed false so what is the purpose of the "else if" branch?
Which of the conditions in intel_pxp_is_supported can it fail on to get here?
And purpose of exiting init with supported = no but i915->pxp set?
Quoted 123 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +16
-8+ +return 0 ; } -void intel_pxp_fini (struct intel_pxp *pxp) +void intel_pxp_fini (struct drm_i915_private *i915) { - pxp->arb_is_valid = false; +if (!i915->pxp) +return ; -intel_pxp_tee_component_fini (pxp); + i915->pxp->arb_is_valid = false; -destroy_vcs_context (pxp); +intel_pxp_tee_component_fini (i915->pxp); + +destroy_vcs_context (i915->pxp); + +kfree (i915->pxp); + i915->pxp =NULL ; }void intel_pxp_mark_termination_in_progress (struct intel_pxp *pxp)@@ -173,7 +219,7 @@ void intel_pxp_mark_termination_in_progress(struct intel_pxp *pxp)static void pxp_queue_termination (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* * We want to get the same effect as if we received a termination @@ -238,13 +284,13 @@ int intel_pxp_start(struct intel_pxp *pxp)void intel_pxp_init_hw (struct intel_pxp *pxp) { -kcr_pxp_enable (pxp_to_gt (pxp)); +kcr_pxp_enable (pxp->ctrl_gt);intel_pxp_irq_enable (pxp); }void intel_pxp_fini_hw (struct intel_pxp *pxp) { -kcr_pxp_disable (pxp_to_gt (pxp)); +kcr_pxp_disable (pxp->ctrl_gt);intel_pxp_irq_disable (pxp); }@@ -278,7 +324,7 @@ int intel_pxp_key_check(struct intel_pxp *pxp,void intel_pxp_invalidate (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_gem_context *ctx, *cn;/* ban all contexts marked as protected */ drivers/gpu/drm/i915/pxp/intel_pxp.h +5
-4@@ -9,15 +9,16 @@#include <linux/errno.h> #include <linux/types.h> -struct intel_pxp ;struct drm_i915_gem_object ; +struct drm_i915_private ; +struct intel_pxp ; -struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp); +bool intel_pxp_is_supported (const struct intel_pxp *pxp);bool intel_pxp_is_enabled (const struct intel_pxp *pxp);bool intel_pxp_is_active (const struct intel_pxp *pxp); -void intel_pxp_init (struct intel_pxp *pxp); -void intel_pxp_fini (struct intel_pxp *pxp); +int intel_pxp_init (struct drm_i915_private *i915); +void intel_pxp_fini (struct drm_i915_private *i915);void intel_pxp_init_hw (struct intel_pxp *pxp);void intel_pxp_fini_hw (struct intel_pxp *pxp);drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c +5
-3@@ -3,9 +3,6 @@* Copyright(c) 2020, Intel Corporation. All rights reserved. */ -#include "intel_pxp.h" -#include "intel_pxp_cmd.h" -#include "intel_pxp_session.h" #include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gpu_commands.h" @@ -13,6 +10,11 @@#include "i915_trace.h" +#include "intel_pxp.h" +#include "intel_pxp_cmd.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" +/* stall until prior PXP and MFX/HCP/HUC objects are cmopleted */ #define MFX_WAIT_PXP (MFX_WAIT | \ MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | \drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +2
-0@@ -9,18 +9,20 @@#include <drm/drm_print.h> #include "gt/intel_gt_debugfs.h" +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_debugfs.h" #include "intel_pxp_irq.h"
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c line 25
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +2
-2+#include "intel_pxp_types.h" static int pxp_info_show (struct seq_file *m,void *data) {struct intel_pxp *pxp = m->private;struct drm_printer p =drm_seq_file_printer (m); -bool enabled =intel_pxp_is_enabled (pxp); -if (!enabled) { +if (!intel_pxp_is_enabled (pxp)) {
Meh.
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +3
-1drm_printf (&p,"pxp disabled\n" );return 0 ; }@@ -30,7 +32,19 @@ static int pxp_info_show(struct seq_file *m, void *data)return 0 ; } -DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE (pxp_info); + +static int pxp_info_open (struct inode *inode,struct file *file) +{
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c static int pxp_info_show(struct seq_file *m, void *data) · line 47
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +10
-0+return single_open (file, pxp_info_show, inode->i_private); +} + +static const struct file_operations pxp_info_fops = { + .owner =THIS_MODULE , + .open = pxp_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};
DEFINE_SHOW_ATTRIBUTE?
Quoted 107 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +15
-12static int pxp_terminate_get (void *data,u64 *val) {@@ -41,7 +55,7 @@ static int pxp_terminate_get(void *data, u64 *val)static int pxp_terminate_set (void *data,u64 val) {struct intel_pxp *pxp = data; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;if (!intel_pxp_is_active (pxp))return -ENODEV ;@@ -59,23 +73,26 @@ static int pxp_terminate_set(void *data, u64 val) }DEFINE_SIMPLE_ATTRIBUTE (pxp_terminate_fops, pxp_terminate_get, pxp_terminate_set,"%llx\n" ); -void intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *gt_root) + +void intel_pxp_debugfs_register (struct intel_pxp *pxp) { -static const struct intel_gt_debugfs_file files[] = { - {"info" , &pxp_info_fops,NULL }, - {"terminate_state" , &pxp_terminate_fops,NULL }, - }; -struct dentry *root; +struct drm_minor *minor; +struct dentry *pxproot; -if (!gt_root) +if (!intel_pxp_is_supported (pxp))return ; -if (!HAS_PXP ((pxp_to_gt (pxp)->i915))) + minor = pxp->ctrl_gt->i915->drm.primary; +if (!minor->debugfs_root)return ; - root =debugfs_create_dir ("pxp" , gt_root); -if (IS_ERR (root)) + pxproot =debugfs_create_dir ("pxp" , minor->debugfs_root); +if (IS_ERR (pxproot))return ; -intel_gt_debugfs_register_files (root, files,ARRAY_SIZE (files), pxp); +debugfs_create_file ("info" ,0444 , pxproot, + pxp, &pxp_info_fops); + +debugfs_create_file ("terminate_state" ,0644 , pxproot, + pxp, &pxp_terminate_fops); }drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.h +2
-2@@ -10,10 +10,10 @@ struct intel_pxp;struct dentry ;#ifdef CONFIG_DRM_I915_PXP -void intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root); +void intel_pxp_debugfs_register (struct intel_pxp *pxp);#else static inline void -intel_pxp_debugfs_register (struct intel_pxp *pxp,struct dentry *root) +intel_pxp_debugfs_register (struct intel_pxp *pxp) { }#endif drivers/gpu/drm/i915/pxp/intel_pxp_huc.c +1
-1@@ -18,7 +18,7 @@int intel_pxp_huc_load_and_auth (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct intel_huc *huc = >->uc.huc;struct pxp43_start_huc_auth_in huc_in = {0 };struct pxp43_start_huc_auth_out huc_out = {0 };drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +7
-3@@ -3,14 +3,18 @@* Copyright(c) 2020 Intel Corporation. */ #include <linux/workqueue.h> -#include "intel_pxp.h" -#include "intel_pxp_irq.h" -#include "intel_pxp_session.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_regs.h" #include "gt/intel_gt_types.h" +#include "i915_irq.h" #include "i915_reg.h" + +#include "intel_pxp.h" +#include "intel_pxp_irq.h" +#include "intel_pxp_session.h" +#include "intel_pxp_types.h" #include "intel_runtime_pm.h" /**
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c line 29
Quoted 7 lines
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +1
-1@@ -20,7 +24,7 @@*/ void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt; if (GEM_WARN_ON(!intel_pxp_is_enabled(pxp))) > return;
The early return is now less effective with spurious interrupts because potentially NULL pxp has already been dereferenced to get the gt.
Quoted 221 lines
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +2
-2@@ -62,7 +66,7 @@ static inline void pxp_irq_reset(struct intel_gt *gt)void intel_pxp_irq_enable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;spin_lock_irq (gt->irq_lock);@@ -77,7 +81,7 @@ void intel_pxp_irq_enable(struct intel_pxp *pxp)void intel_pxp_irq_disable (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* * We always need to submit a global termination when we re-enable the drivers/gpu/drm/i915/pxp/intel_pxp_pm.c +4
-2@@ -3,11 +3,13 @@* Copyright(c) 2020 Intel Corporation. */ +#include "i915_drv.h" +#include "intel_pxp.h" #include "intel_pxp_irq.h" #include "intel_pxp_pm.h" #include "intel_pxp_session.h" -#include "i915_drv.h" +#include "intel_pxp_types.h" void intel_pxp_suspend_prepare (struct intel_pxp *pxp) {@@ -26,7 +28,7 @@ void intel_pxp_suspend(struct intel_pxp *pxp)if (!intel_pxp_is_enabled (pxp))return ; - with_intel_runtime_pm(&pxp_to_gt(pxp)->i915->runtime_pm, wakeref) { + with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref) {intel_pxp_fini_hw (pxp); pxp->hw_state_invalidated = false; }drivers/gpu/drm/i915/pxp/intel_pxp_session.c +5
-5@@ -20,7 +20,7 @@static bool intel_pxp_session_is_in_play (struct intel_pxp *pxp,u32 id) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 sip =0 ;@@ -33,7 +33,7 @@ static bool intel_pxp_session_is_in_play(struct intel_pxp *pxp, u32 id)static int pxp_wait_for_session_state (struct intel_pxp *pxp,u32 id,bool in_play) { -struct intel_uncore *uncore =pxp_to_gt (pxp)->uncore; +struct intel_uncore *uncore = pxp->ctrl_gt->uncore;intel_wakeref_t wakeref;u32 mask =BIT (id);int ret;@@ -56,7 +56,7 @@ static int pxp_wait_for_session_state(struct intel_pxp *pxp, u32 id, bool in_plastatic int pxp_create_arb_session (struct intel_pxp *pxp) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;int ret; pxp->arb_is_valid = false;@@ -90,7 +90,7 @@ static int pxp_create_arb_session(struct intel_pxp *pxp)static int pxp_terminate_arb_session_and_global (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;/* must mark termination in progress calling this function */ GEM_WARN_ON (pxp->arb_is_valid);@@ -141,7 +141,7 @@ static void pxp_terminate_complete(struct intel_pxp *pxp)static void pxp_session_work (struct work_struct *work) {struct intel_pxp *pxp =container_of (work,typeof (*pxp), session_work); -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;intel_wakeref_t wakeref;u32 events =0 ;drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +13
-18@@ -11,25 +11,20 @@#include "gem/i915_gem_lmem.h" #include "i915_drv.h" +#include "intel_pxp.h" -#include "intel_pxp_session.h" -#include "intel_pxp_tee.h" #include "intel_pxp_cmd_interface_42.h" #include "intel_pxp_huc.h" - -static inline struct intel_pxp *i915_dev_to_pxp (struct device *i915_kdev) -{ -struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); - -return &to_gt (i915)->pxp; -} +#include "intel_pxp_session.h" +#include "intel_pxp_tee.h" +#include "intel_pxp_types.h" static int intel_pxp_tee_io_message (struct intel_pxp *pxp,void *msg_in,u32 msg_in_size,void *msg_out,u32 msg_out_max_size,u32 *msg_out_rcv_size) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;int ret =0 ;@@ -79,7 +74,7 @@ int intel_pxp_tee_stream_message(struct intel_pxp *pxp, {/* TODO: for bigger objects we need to use a sg of 4k pages */ const size_t max_msg_size =PAGE_SIZE ; -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct i915_pxp_component *pxp_component = pxp->pxp_component;unsigned int offset =0 ;struct scatterlist *sg;@@ -127,8 +122,8 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); -struct intel_uc *uc = &pxp_to_gt (pxp)->uc; +struct intel_pxp *pxp = i915->pxp; +struct intel_uc *uc = &pxp->ctrl_gt->uc;intel_wakeref_t wakeref;int ret =0 ;@@ -164,7 +159,7 @@ static void i915_pxp_tee_component_unbind(struct device *i915_kdev, struct device *tee_kdev, void *data) { struct drm_i915_private *i915 = kdev_to_i915(i915_kdev); -struct intel_pxp *pxp =i915_dev_to_pxp (i915_kdev); +struct intel_pxp *pxp = i915->pxp;intel_wakeref_t wakeref;if (intel_pxp_is_enabled (pxp))@@ -183,7 +178,7 @@ static const struct component_ops i915_pxp_tee_component_ops = {static int alloc_streaming_command (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct drm_i915_gem_object *obj =NULL ;void *cmd;int err;@@ -244,7 +239,7 @@ static void free_streaming_command(struct intel_pxp *pxp)int intel_pxp_tee_component_init (struct intel_pxp *pxp) {int ret; -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;struct drm_i915_private *i915 = gt->i915;mutex_init (&pxp->tee_mutex);@@ -271,7 +266,7 @@ int intel_pxp_tee_component_init(struct intel_pxp *pxp)void intel_pxp_tee_component_fini (struct intel_pxp *pxp) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;if (!pxp->pxp_component_added)return ;@@ -285,7 +280,7 @@ void intel_pxp_tee_component_fini(struct intel_pxp *pxp)int intel_pxp_tee_cmd_create_arb_session (struct intel_pxp *pxp,int arb_session_id) { -struct drm_i915_private *i915 =pxp_to_gt (pxp)->i915; +struct drm_i915_private *i915 = pxp->ctrl_gt->i915;struct pxp42_create_arb_in msg_in = {0 };struct pxp42_create_arb_out msg_out = {0 };int ret;drivers/gpu/drm/i915/pxp/intel_pxp_types.h +8
-0@@ -12,12 +12,20 @@#include <linux/workqueue.h> struct intel_context ; +struct intel_gt ;struct i915_pxp_component ; +struct drm_i915_private ;/** * struct intel_pxp - pxp state */ struct intel_pxp { +/** +* @ctrl_gt: poiner to the tile that owns the controls for PXP subsystem assets that +* the VDBOX, the KCR engine (and GSC CS depending on the platform) +*/ +struct intel_gt *ctrl_gt; +/** * @pxp_component: i915_pxp_component struct of the bound mei_pxp * module. Only set and cleared inside component bind/unbind functions,
Quoted 1 line
base-commit:
886c7f9510ce20f099d27d9e7d9de32402c9e5e6
I haven't read it all in detail but just a gut feel init flow is not easy enough to understand, feels like it should be streamlined and simplified to become as self-documenting as possible. Plus some minor details.
Regards,
Tvrtko
Quoted 2 lines · Tvrtko Ursulin
Quoted 1 line · Alan Previn
Alan: [snip]
Quoted 15 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 54
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-2-struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false; +return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt));
Intel_pxp_is_supportedoperating on the pxp reads a bit funny when one of the checks is for NULL passed in object to start with.
Quoted 2 lines
And all callers pass in
i915->pxpso my immediate thought is whetheri915_pxp_is_supported(i915)was considered?
Alan: I think you might need to track back through the last couple of months of this patch (probably back to rev4 or 5)... I was told the coding practice is intel_subsystem_function(struct subsystem...) so pxp should have pxp as its input structure. We needed to make exceptions for init/fini because ptr-to-ptr is worse - but we all agreed we dont want viral include header hiearchys so dynamic allocation is the right way to go. ('we' included Jani + Rodrigo). As such i wont change this - but i will wait for your confirmation before i re-rev. Side note: with all due respect it would be nice to have comments preceeded with "nack" or "nit" or "question".
Alan: [snip]
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0@@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); }
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 158
Quoted 6 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-2-void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;No need to init.
Alan: Sorry - i hate not initing local vars - is this a nack?
Quoted 17 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ;drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 169
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */ +if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; +None of this makes sense unless
CONFIG_DRM_I915_PXP, right?
Alan: No - when we dont support PXP as a feature we still need the backend Tee-link infrastructure that PXP provides for GSC HuC authentication for DG2 - this existing code path. I can add some additional comments. (im using Tee losely here since its not actual Tee but an intel specific framework to provide access to security firwmare).
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{ + i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915);
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 184
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-0+if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }If you store
ctrl_gtin a local then you don't have to allocate until you'll know you need it, however..
Alan: see my reply below.
Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 194
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-4*/ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp);...
intel_pxp_is_supported()returnsed false so what is the purpose of the "else if" branch?
Quoted 5 lines
Which of the conditions in
intel_pxp_is_supportedcan it fail on to get here?And purpose of exiting init with supported = no but
i915->pxpset?
Alan: So this was prior existing code flow i did not change - but i can add an "else if (intel_pxp_tee_is_needed())" and that can be a wrapper around those gsc-huc-authentication and tee backend transport dependency needs.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +7
-1-DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE (pxp_info); + +static int pxp_info_open (struct inode *inode,struct file *file) +{ +return single_open (file, pxp_info_show, inode->i_private); +} + +static const struct file_operations pxp_info_fops = {
Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c static int pxp_info_show(struct seq_file *m, void *data) · line 47
Quoted 6 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +6
-0+ .owner = THIS_MODULE, + .open = pxp_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};
DEFINE_SHOW_ATTRIBUTE?
Alan: okay.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +1
-1/** @@ -20,7 +24,7 @@*/ void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;
Quoted 5 lines
Review line 29
Quoted 1 line
(quoted diff) +0
-0if (GEM_WARN_ON(!intel_pxp_is_enabled(pxp))) > return;The early return is now less effective with spurious interrupts because potentially NULL pxp has already been dereferenced to get the gt.
Alan: Good catch - i will fix this by not doing the dereference first until after the enabled check is called.
Quoted 7 lines
I haven't read it all in detail but just a gut feel init flow is not easy enough to understand, feels like it should be streamlined and simplified to become as self-documenting as possible. Plus some minor details.
Alan: The init flow is mostly identical to existing codes except for bringing the contents of HAS_PXP into the init codes since that macro is not needed to be included from i915_drv.h (not used externally). I can add more comments but i don't think it would help much without understanding all of the quirks of the PXP subsystem feature and framework. But i can at least add some more comments.
Quoted 21 lines · Alan Previn
Quoted 2 lines · Tvrtko Ursulin
Quoted 1 line · Alan Previn
Alan: [snip]
Quoted 15 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 54
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-2-struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false; +return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt));
Intel_pxp_is_supportedoperating on the pxp reads a bit funny when one of the checks is for NULL passed in object to start with.
Quoted 8 lines
Quoted 2 lines
And all callers pass in
i915->pxpso my immediate thought is whetheri915_pxp_is_supported(i915)was considered?Alan: I think you might need to track back through the last couple of months of this patch (probably back to rev4 or 5)... I was told the coding practice is
intel_subsystem_function(struct subsystem...)so pxp should have pxp as its input structure. We needed to make exceptions for init/fini because ptr-to-ptr is worse - but we all agreed we dont want viral include header hiearchys so dynamic allocation is the right way to go. ('we' included Jani + Rodrigo). As such i
I said nothing about dynamic allocation. I said, since you are promoting pxp to be under i915, and have a this:
intel_pxp_is_supported(pxp)
{
...
if (!pxp) return false;
(There's even a gt->i915->has_pxp in there, and a Kconfig based check, so it really does not feel this should operate on the pxp.)
And callers to all these three function pass in, most even directly, i915->pxp, that passing in a NULL pxp to function tell you you passed in NULL pxp reads confused.
I asked if this alternative was considered (function prefix follow target object):
i915_pxp_is_supported(i915)
Or if you want to follow the alternative preference (function prefix follows file prefix):
intel_pxp_is_supported(i915)
Nothing about dropping the dynamic allocation in this question...
Oh would IS_ENABLED(CONFIG_DRM_I915_PXP) be right in intel_pxp_is_enabled/active? If so maybe worth to add for some extra dead code elimination.
Quoted 2 lines
wont change this - but i will wait for your confirmation before i re-rev. Side note: with all due respect it would be nice to have comments preceeded with "nack" or "nit" or "question".
"Discussion in progress please hold".
Quoted 17 lines
Alan: [snip]
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0@@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); }Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 158
Quoted 6 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-2-void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;No need to init.
Quoted 1 line
Alan: Sorry - i hate not initing local vars - is this a nack?
Then you hate consistency as well? :) It is a very typical review feedback. Look around the mailing list and the code and count how many needlessly initialized locals we have. You just align it with the codebase and move on..
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ;drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 169
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */ +if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; +None of this makes sense unless
CONFIG_DRM_I915_PXP, right?
Quoted 3 lines
Alan: No - when we dont support PXP as a feature we still need the backend Tee-link infrastructure that PXP provides for GSC HuC authentication for DG2 - this existing code path. I can add some additional comments. (im using Tee losely here since its not actual Tee but an intel specific framework to provide access to security firwmare).
Okay so is the answer i915->pxp is not the same PXP as CONFIG_DRM_I915_PXP. Latter is kind of the user facing part, while i915->pxp is set when the PXP hardware actually exists. I got this right? If so how about splitting intel_pxp_is_supported into two (or more?) so it does not answer two separate questions?
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{ + i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915);Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 184
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-0+if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }If you store
ctrl_gtin a local then you don't have to allocate until you'll know you need it, however..
Quoted 1 line
Alan: see my reply below.
To be clear I was merely suggesting to avoid the need to free something just allocated:
int intel_pxp_init(struct drm_i915_private *i915)
{
struct intel_gt *ctrl_gt;
struct intel_pxp *pxp;
ctrl_gt = pxp_get_ctrl_gt(i915);
if (!ctrl_gt)
return -ENODEV;
pxp = kzalloc(...)
if (!pxp)
return -ENOMEM;...
Because it's kind of pointless to alloc+free on every old platform under the sun.
And maybe pxp_get_ctrl_gt should be renamed to some variant of "is needed", but I am not clear yet on that.
Quoted 19 lines
Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 194
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-4*/ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp);...
intel_pxp_is_supported()returnsed false so what is the purpose of the "else if" branch?
Quoted 7 lines
Quoted 5 lines
Which of the conditions in
intel_pxp_is_supportedcan it fail on to get here?And purpose of exiting init with supported = no but
i915->pxpset?Alan: So this was prior existing code flow i did not change - but i can add an "else if (
intel_pxp_tee_is_needed())" and that can be a wrapper around those gsc-huc-authentication and tee backend transport dependency needs.
Hm, okay. So here you have:
+ if (intel_pxp_is_supported(i915->pxp))
+ pxp_init_full(i915->pxp);
+ else if (pxp_backend_tee_is_needed(i915->pxp))
+ intel_pxp_tee_component_init(i915->pxp);
+
+ return 0;
1)
If both these branches are false, is there a purpose for the dangling i915->pxp object?
Or if they cannot both be false is this the clearest way to express the flow? ("else GEM_WARN_ON()" at least?)
2)
If there are no vdboxes is the last (else if) branch needed? If it is for loading the HuC then possibly sounds like no. So maybe the vdbox check can be early in pxp_get_ctrl_gt?
Regards,
Tvrtko
Quoted 47 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +7
-1-DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE (pxp_info); + +static int pxp_info_open (struct inode *inode,struct file *file) +{ +return single_open (file, pxp_info_show, inode->i_private); +} + +static const struct file_operations pxp_info_fops = {Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c static int pxp_info_show(struct seq_file *m, void *data) · line 47
Quoted 6 lines
drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c +6
-0+ .owner = THIS_MODULE, + .open = pxp_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};
DEFINE_SHOW_ATTRIBUTE?Alan: okay.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp_irq.c +1
-1/** @@ -20,7 +24,7 @@*/ void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt = pxp->ctrl_gt;Quoted 5 lines
Review line 29
Quoted 1 line
(quoted diff) +0
-0if (GEM_WARN_ON(!intel_pxp_is_enabled(pxp))) > return;The early return is now less effective with spurious interrupts because potentially NULL pxp has already been dereferenced to get the gt.
Alan: Good catch - i will fix this by not doing the dereference first until after the enabled check is called.
Quoted 7 lines
I haven't read it all in detail but just a gut feel init flow is not easy enough to understand, feels like it should be streamlined and simplified to become as self-documenting as possible. Plus some minor details.
Alan: The init flow is mostly identical to existing codes except for bringing the contents of
HAS_PXPinto the init codes since that macro is not needed to be included fromi915_drv.h(not used externally). I can add more comments but i don't think it would help much without understanding all of the quirks of the PXP subsystem feature and framework. But i can at least add some more comments.
Quoted 36 lines · Tvrtko Ursulin
Quoted 21 lines · Alan Previn
Quoted 2 lines · Tvrtko Ursulin
Quoted 1 line · Alan Previn
Alan: [snip]
Quoted 15 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 54
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-2-struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false; +return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt));
Intel_pxp_is_supportedoperating on the pxp reads a bit funny when one of the checks is for NULL passed in object to start with.Quoted 8 lines
Quoted 2 lines
And all callers pass in
i915->pxpso my immediate thought is whetheri915_pxp_is_supported(i915)was considered?Alan: I think you might need to track back through the last couple of months of this patch (probably back to rev4 or 5)... I was told the coding practice is
intel_subsystem_function(struct subsystem...)so pxp should have pxp as its input structure. We needed to make exceptions for init/fini because ptr-to-ptr is worse - but we all agreed we dont want viral include header hiearchys so dynamic allocation is the right way to go. ('we' included Jani + Rodrigo). As such iI said nothing about dynamic allocation. I said, since you are promoting pxp to be under i915, and have a this:
intel_pxp_is_supported(pxp)
{
...
Quoted 7 lines
if (!pxp) return false;(There's even a
gt->i915->has_pxpin there, and aKconfigbased check, so it really does not feel this should operate on the pxp.)And callers to all these three function pass in, most even directly,
i915->pxp, that passing in a NULL pxp to function tell you you passed in NULL pxp reads confused.
Alan: So prior to rev-9 i always allocated i915->pxp and would use the other params such as the pxp->ce or those pxp-
Quoted 1 line
is_arb_validwithout checking the validity of the pxp ptr for those helpers. Daniele said its very unlikely but
possible to have i915->pxp allocation fail and other functions get called and so said its better to explicitily leave i915->pxp as null for cases where the backend tee-hw was also not available (and hence the ptr checking added in those helpers).
Quoted 8 lines
I asked if this alternative was considered (function prefix follow target object):
i915_pxp_is_supported(i915)Or if you want to follow the alternative preference (function prefix follows file prefix):
intel_pxp_is_supported(i915)
Alan: I believe somewhere in rev 5 or 6 this was discussed by Rodrigo/Janie ... IIRC the summary was that coding practice is to go with the function name + first param in the form of: intel_[subsystem]_function(struct [subsystem] *...) and we decided to stick with that for everything except the exceptions for init/fini.
I can re-spin if you think its better to extend that exception to intel_pxp_is_supported/active.
Hmmm... OR...
actually, what do you think about extending this for all other top-level entry points that may called externally? (there are several more: irq handler, huc-loading code, debugfs, pxp-key-check, suspend-resume. Change all for consistency (agnostic to whether they are prepend with a call to is_enabled/active first).
And then ... there is an completely different alternative method (building on top of Rev8 instead):
Perhaps we can also always allocate i915->pxp to be valid and only use other params like "pxp->component", "pxp->ce", etc external facing functions. But i think this is not the right way - if the far future were to see all subsystems get dynamically allocated (and reducing header-file-triggered build times), then it makes sense to expect nly valid subsystems to be allocated.
Quoted 4 lines
Nothing about dropping the dynamic allocation in this question...
Oh would
IS_ENABLED(CONFIG_DRM_I915_PXP)be right in intel_pxp_is_enabled/active? If so maybe worth to add for some extra dead code elimination.
Alan: Adding IS_ENABLED(CONFIG_DRM_I915_PXP) in intel_pxp_is_enabled/active should be fine. But take note that on platforms that DO support pxp, we would go thru that new line and then check 'pxp' and 'pxp->ce' validity again so 3 cycles as opposed to 2 to accomplish the same thing - seems unnecessary to me. NOTE: intel_pxp_is_supported is special since it's called from within intel_pxp_init so it needs these extra checks for the build config, has-pxp and engine- mask.
Quoted 22 lines
Quoted 2 lines
wont change this - but i will wait for your confirmation before i re-rev. Side note: with all due respect it would be nice to have comments preceeded with "nack" or "nit" or "question".
"Discussion in progress please hold".
Quoted 17 lines
Alan: [snip]
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 158
Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-2@@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); } -void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;No need to init.
Quoted 4 lines
Quoted 1 line
Alan: Sorry - i hate not initing local vars - is this a nack?
Then you hate consistency as well? :) It is a very typical review feedback. Look around the mailing list and the code and count how many needlessly initialized locals we have. You just align it with the codebase and move on..
Alan: Ofc - its already fixed in rev10. :)
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ;drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 169
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */ +if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; +None of this makes sense unless
CONFIG_DRM_I915_PXP, right?
Quoted 6 lines
Quoted 3 lines
Alan: No - when we dont support PXP as a feature we still need the backend Tee-link infrastructure that PXP provides for GSC HuC authentication for DG2 - this existing code path. I can add some additional comments. (im using Tee losely here since its not actual Tee but an intel specific framework to provide access to security firwmare).
Okay so is the answer
i915->pxpis not the same PXP asCONFIG_DRM_I915_PXP. Latter is kind of the user facing part, whilei915->pxpis set when the PXP hardware actually exists. I got this right?
Alan: Yes'-ish'. i915->pxp is only set when [1] we want the user-facing-feature AND the HW is there or [2] the hardware is there AND we need it for specific platform usages like DG2 HuC authentication. For example, we could have a ADL with a DG1. ADL will be the case of [1] while D1 will not see either case. However, if we had a DG2 instead of a DG1, then i915->pxp would still be there (but not have the user-facing feature).
Quoted 2 lines
If so how about splitting
intel_pxp_is_supportedinto two (or more?) so it does not answer two separate questions?
Alan: I'm not sure i understand what you mean. "intel_pxp_is_supported" is only answering the user-facing question and not if the backend is require for PXP.
Quoted 35 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{ + i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915);Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 184
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-0+if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }If you store
ctrl_gtin a local then you don't have to allocate until you'll know you need it, however..Quoted 1 line
Alan: see my reply below.
To be clear I was merely suggesting to avoid the need to free something just allocated:
int
intel_pxp_init(struct drm_i915_private *i915){ struct intel_gt *ctrl_gt; struct intel_pxp *pxp; ctrl_gt = pxp_get_ctrl_gt(i915); if (!ctrl_gt) return -ENODEV; pxp = kzalloc(...) if (!pxp) return -ENOMEM;
Quoted 3 lines
...
Because it's kind of pointless to alloc+free on every old platform under the sun.
Alan: oh okay - yes, ofc - sorry, i think was lacking coffee when i read that the first time.
Quoted 40 lines
And maybe
pxp_get_ctrl_gtshould be renamed to some variant of "is needed", but I am not clear yet on that.Quoted 19 lines
Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 194
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-4*/ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp);...
intel_pxp_is_supported()returnsed false so what is the purpose of the "else if" branch?Quoted 7 lines
Quoted 5 lines
Which of the conditions in
intel_pxp_is_supportedcan it fail on to get here?And purpose of exiting init with supported = no but
i915->pxpset?Alan: So this was prior existing code flow i did not change - but i can add an "else if (
intel_pxp_tee_is_needed())" and that can be a wrapper around those gsc-huc-authentication and tee backend transport dependency needs.Hm, okay. So here you have:
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-0+if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (pxp_backend_tee_is_needed (i915->pxp)) +intel_pxp_tee_component_init (i915->pxp); + +return 0 ;
Quoted 5 lines
1)
If both these branches are false, is there a purpose for the dangling
i915->pxpobject?Or if they cannot both be false is this the clearest way to express the flow? ("else
GEM_WARN_ON()" at least?)
Alan: Both branches can be false.
Quoted 5 lines
2)
If there are no vdboxes is the last (else if) branch needed? If it is for loading the HuC then possibly sounds like no. So maybe the vdbox check can be early in
pxp_get_ctrl_gt?
Alan: Yes that's possible. So in that case we are folding a lot more checks into the ctrl-gt. But we need a name that truly reflects that it does. Coz now its gonna check for "MediaGT with GSC on MTL" or "GT0 on pre-MTL but with MEI KConfig AND VDBOX) so something like "get_suitable_ctrl_gt_for_backend_tee()". However, this still doesnt mean the two branches will never be both false - the 2nd branch can still be false - we could have VDBOX but huc fw not avail. Something like this at the end? Should we free up pxp is not used at all? :
int intel_pxp_init(struct drm_i915_private *i915)
{
intel_gt *gt;
intel_pxp *pxp;
/*
* NOTE: Get a suitable ctrl_gt before checking intel_pxp_is_supported
* since we still also it if backend tee transport is needed for other
* platform requirements. Suitable gt checks include gsc-engine/vdbox/Kconfig
*/
gt = pxp_find_suitable_ctrl_gt(i915);
if (!gt)
return -ENODEV;
pxp = kzalloc(sizeof(*i915->pxp), GFP_KERNEL);
if (!pxp)
return -ENOMEM;
pxp->ctrl_gt = gt;
/*
* If HuC is loaded by GSC but PXP is disabled, we can skip the init of
* the full PXP session/object management and just init the tee channel.
*/
if (intel_pxp_is_supported(pxp)) {
pxp_init_full(pxp);
} else if (pxp_backend_tee_is_needed(pxp)) {
intel_pxp_tee_component_init(pxp);
} else {
kfree(pxp);
pxp = NULL;
}
i915->pxp = pxp;
return 0;
}Quoted 4 lines
Regards,
Tvrtko
Alan:[snip]
[Side note - your email client somehow manages to make a mess of line wraps so after a few replies it is super hard to follow the quote. Don't know how/what/why but I don't have this problem on the mailing list with other folks so at least I *think* it is something about your client or it's configuration.]
Quoted 42 lines · Alan Previn
Quoted 41 lines · Tvrtko Ursulin
Quoted 21 lines · Alan Previn
Quoted 2 lines · Tvrtko Ursulin
Quoted 1 line · Alan Previn
Alan: [snip]
Quoted 15 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c line 54
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-2-struct intel_gt *pxp_to_gt (const struct intel_pxp *pxp) +bool intel_pxp_is_supported (const struct intel_pxp *pxp) { - return container_of(pxp, struct intel_gt, pxp); +if (!IS_ENABLED (CONFIG_DRM_I915_PXP )) +return false; +else if (!pxp) +return false; +return (INTEL_INFO (pxp->ctrl_gt->i915)->has_pxp &&VDBOX_MASK (pxp->ctrl_gt));
Intel_pxp_is_supportedoperating on the pxp reads a bit funny when one of the checks is for NULL passed in object to start with.Quoted 8 lines
Quoted 2 lines
And all callers pass in
i915->pxpso my immediate thought is whetheri915_pxp_is_supported(i915)was considered?Alan: I think you might need to track back through the last couple of months of this patch (probably back to rev4 or 5)... I was told the coding practice is
intel_subsystem_function(struct subsystem...)so pxp should have pxp as its input structure. We needed to make exceptions for init/fini because ptr-to-ptr is worse - but we all agreed we dont want viral include header hiearchys so dynamic allocation is the right way to go. ('we' included Jani + Rodrigo). As such iI said nothing about dynamic allocation. I said, since you are promoting pxp to be under i915, and have a this:
intel_pxp_is_supported(pxp)
{
...if (!pxp) return false;(There's even a
gt->i915->has_pxpin there, and aKconfigbased check, so it really does not feel this should operate on the pxp.)
Quoted 7 lines
Quoted 2 lines
And callers to all these three function pass in, most even directly,
i915->pxp, that passing in a NULL pxp to function tell you you passed in NULL pxp reads confused.Alan: So prior to rev-9 i always allocated
i915->pxpand would use the other params such as thepxp->ceor those pxp-Quoted 1 line
is_arb_validwithout checking the validity of the pxp ptr for those helpers. Daniele said its very unlikely butpossible to have
i915->pxpallocation fail and other functions get called and so said its better to explicitily leavei915->pxpas null for cases where the backend tee-hw was also not available (and hence the ptr checking added in those helpers).
Null check is fine, I was a bit bothered by the helpers operating on pxp. But lets put this aside for now and focus on the init path.
Quoted 21 lines
Quoted 8 lines
I asked if this alternative was considered (function prefix follow target object):
i915_pxp_is_supported(i915)Or if you want to follow the alternative preference (function prefix follows file prefix):
intel_pxp_is_supported(i915)Alan: I believe somewhere in rev 5 or 6 this was discussed by Rodrigo/Janie ... IIRC the summary was that coding practice is to go with the function name + first param in the form of: intel_[subsystem]_function(struct [subsystem] *...) and we decided to stick with that for everything except the exceptions for init/fini.
I can re-spin if you think its better to extend that exception to intel_pxp_is_supported/active.
Hmmm... OR...
actually, what do you think about extending this for all other top-level entry points that may called externally? (there are several more: irq handler, huc-loading code, debugfs, pxp-key-check, suspend-resume. Change all for consistency (agnostic to whether they are prepend with a call to is_enabled/active first).
Quoted 7 lines
And then ... there is an completely different alternative method (building on top of Rev8 instead):
Perhaps we can also always allocate
i915->pxpto be valid and only use other params like "pxp->component", "pxp->ce", etc external facing functions. But i think this is not the right way - if the far future were to see all subsystems get dynamically allocated (and reducing header-file-triggered build times), then it makes sense to expect nly valid subsystems to be allocated.
I agree it is correct to have i915->pxp optionally present. That should stay.
Quoted 9 lines
Quoted 4 lines
Nothing about dropping the dynamic allocation in this question...
Oh would
IS_ENABLED(CONFIG_DRM_I915_PXP)be right in intel_pxp_is_enabled/active? If so maybe worth to add for some extra dead code elimination.Alan: Adding
IS_ENABLED(CONFIG_DRM_I915_PXP)in intel_pxp_is_enabled/active should be fine. But take note that on platforms that DO support pxp, we would go thru that new line and then check 'pxp' and 'pxp->ce' validity again so 3 cycles as opposed to 2 to accomplish the same thing - seems unnecessary to me. NOTE:intel_pxp_is_supportedis special since it's called from withinintel_pxp_initso it needs these extra checks for the build config, has-pxp and engine- mask.
IS_ENABLED is always optimized away, be it 1 or 0, since it is a compile time constant. So it doesn't increase the number of runtime conditionals.
And for intel_pxp_is_supported, lets see below if it needs to remain so special.
Quoted 149 lines
Quoted 22 lines
Quoted 2 lines
wont change this - but i will wait for your confirmation before i re-rev. Side note: with all due respect it would be nice to have comments preceeded with "nack" or "nit" or "question".
"Discussion in progress please hold".
Quoted 17 lines
Alan: [snip]
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 158
Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-2@@ -138,31 +152,63 @@ static void pxp_init_full(struct intel_pxp *pxp)destroy_vcs_context (pxp); } -void intel_pxp_init (struct intel_pxp *pxp) +static struct intel_gt *pxp_get_ctrl_gt (struct drm_i915_private *i915) { -struct intel_gt *gt =pxp_to_gt (pxp); +struct intel_gt *gt =NULL ; +int i =0 ;No need to init.
Quoted 4 lines
Quoted 1 line
Alan: Sorry - i hate not initing local vars - is this a nack?
Then you hate consistency as well? :) It is a very typical review feedback. Look around the mailing list and the code and count how many needlessly initialized locals we have. You just align it with the codebase and move on..
Alan: Ofc - its already fixed in rev10. :)
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-3-/* we rely on the mei PXP module */ -if (!IS_ENABLED (CONFIG_INTEL_MEI_PXP )) -return ;drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 169
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+for_each_gt (gt, i915, i) { +/* There can be only one GT with GSC-CS that supports PXP */ +if (HAS_ENGINE (gt,GSC0 )) +return gt; + } + +/* Else we rely on the GT-0 with mei PXP module */ +if (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) && !i915->media_gt) +return &i915->gt0; +None of this makes sense unless
CONFIG_DRM_I915_PXP, right?Quoted 6 lines
Quoted 3 lines
Alan: No - when we dont support PXP as a feature we still need the backend Tee-link infrastructure that PXP provides for GSC HuC authentication for DG2 - this existing code path. I can add some additional comments. (im using Tee losely here since its not actual Tee but an intel specific framework to provide access to security firwmare).
Okay so is the answer
i915->pxpis not the same PXP asCONFIG_DRM_I915_PXP. Latter is kind of the user facing part, whilei915->pxpis set when the PXP hardware actually exists. I got this right?Alan: Yes'-ish'.
i915->pxpis only set when [1] we want the user-facing-feature AND the HW is there or [2] the hardware is there AND we need it for specific platform usages like DG2 HuC authentication. For example, we could have a ADL with a DG1. ADL will be the case of [1] while D1 will not see either case. However, if we had a DG2 instead of a DG1, theni915->pxpwould still be there (but not have the user-facing feature).Quoted 2 lines
If so how about splitting
intel_pxp_is_supportedinto two (or more?) so it does not answer two separate questions?Alan: I'm not sure i understand what you mean. "
intel_pxp_is_supported" is only answering the user-facing question and not if the backend is require for PXP.Quoted 35 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +10
-0+return NULL ; +} + +int intel_pxp_init (struct drm_i915_private *i915) +{ + i915->pxp =kzalloc (sizeof (*i915->pxp),GFP_KERNEL ); +if (!i915->pxp) +return -ENOMEM ; + + i915->pxp->ctrl_gt =pxp_get_ctrl_gt (i915);Quoted 8 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 184
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-0+if (!i915->pxp->ctrl_gt) { +kfree (i915->pxp); + i915->pxp =NULL ; +return -ENODEV ; + }If you store
ctrl_gtin a local then you don't have to allocate until you'll know you need it, however..Quoted 1 line
Alan: see my reply below.
To be clear I was merely suggesting to avoid the need to free something just allocated:
int
intel_pxp_init(struct drm_i915_private *i915){ struct intel_gt *ctrl_gt; struct intel_pxp *pxp; ctrl_gt = pxp_get_ctrl_gt(i915); if (!ctrl_gt) return -ENODEV; pxp = kzalloc(...) if (!pxp) return -ENOMEM;Quoted 3 lines
...
Because it's kind of pointless to alloc+free on every old platform under the sun.
Alan: oh okay - yes, ofc - sorry, i think was lacking coffee when i read that the first time.
Quoted 40 lines
And maybe
pxp_get_ctrl_gtshould be renamed to some variant of "is needed", but I am not clear yet on that.Quoted 19 lines
Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. drivers/gpu/drm/i915/pxp/intel_pxp.c static void pxp_init_full(struct intel_pxp *pxp) · line 194
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +5
-4*/ -if (HAS_PXP (gt->i915)) -pxp_init_full (pxp); -else if (intel_huc_is_loaded_by_gsc (>->uc.huc) &&intel_uc_uses_huc (>->uc)) -intel_pxp_tee_component_init (pxp); +if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (intel_huc_is_loaded_by_gsc (&i915->pxp->ctrl_gt->uc.huc) && +intel_uc_uses_huc (&i915->pxp->ctrl_gt->uc)) +intel_pxp_tee_component_init (i915->pxp);...
intel_pxp_is_supported()returnsed false so what is the purpose of the "else if" branch?Quoted 7 lines
Quoted 5 lines
Which of the conditions in
intel_pxp_is_supportedcan it fail on to get here?And purpose of exiting init with supported = no but
i915->pxpset?Alan: So this was prior existing code flow i did not change - but i can add an "else if (
intel_pxp_tee_is_needed())" and that can be a wrapper around those gsc-huc-authentication and tee backend transport dependency needs.Hm, okay. So here you have:
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-0+if (intel_pxp_is_supported (i915->pxp)) +pxp_init_full (i915->pxp); +else if (pxp_backend_tee_is_needed (i915->pxp)) +intel_pxp_tee_component_init (i915->pxp); + +return 0 ;Quoted 5 lines
1)
If both these branches are false, is there a purpose for the dangling
i915->pxpobject?Or if they cannot both be false is this the clearest way to express the flow? ("else
GEM_WARN_ON()" at least?)Alan: Both branches can be false.
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
2)
If there are no vdboxes is the last (else if) branch needed? If it is for loading the HuC then possibly sounds like no. So maybe the vdbox check can be early in
pxp_get_ctrl_gt?Alan: Yes that's possible. So in that case we are folding a lot more checks into the ctrl-gt. But we need a name that truly reflects that it does. Coz now its gonna check for "MediaGT with GSC on MTL" or "GT0 on pre-MTL but with MEI KConfig AND VDBOX) so something like "
get_suitable_ctrl_gt_for_backend_tee()". However, this still doesnt mean the two
Right, name is tricky but perhaps doesn't need to be perfect to already clarify the flow.
Quoted 2 lines
branches will never be both false - the 2nd branch can still be false - we could have VDBOX but huc fw not avail. Something like this at the end? Should we free up pxp is not used at all?
Definitely yes - why would we leave a never used object forever allocated?
Quoted 10 lines
int
intel_pxp_init(struct drm_i915_private *i915){ intel_gt *gt; intel_pxp *pxp; /* * NOTE: Get a suitable ctrl_gt before checking intel_pxp_is_supported * since we still also it if backend tee transport is needed for other * platform requirements. Suitable gt checks include gsc-engine/vdbox/Kconfig */
"we still also *need* it"
Good comment.
Quoted 6 lines
gt = pxp_find_suitable_ctrl_gt(i915); if (!gt) return -ENODEV; pxp = kzalloc(sizeof(*i915->pxp), GFP_KERNEL); if (!pxp)
Quoted 8 lines
return -ENOMEM;
pxp->ctrl_gt = gt;
/*
* If HuC is loaded by GSC but PXP is disabled, we can skip the init of
* the full PXP session/object management and just init the tee channel.
*/
if (intel_pxp_is_supported(pxp)) {How does the "full pxp init" branch handle the case of "have vdbox but huc fw is not available"? Presumably i915->pxp is not needed on that path too then? If so that could also be folded into pxp_find_suitable_ctrl_gt and then you wouldn't need the "else kfree" branch below.
Essentially, can you cram more of the static checks into pxp_find_suitable_ctrl_gt and if that one returns a gt, then you definitely know i915->pxp needs to be allocated and just decide on the flavour of initialisation?
I am not entirely sure about has_pxp but would this work:
static struct intel_gt *pxp_find_suitable_ctrl_gt(struct drm_i915_private *i915) {
...
if (!VDBOX_MASK(...))
return NULL; /* Can't possibly need pxp */
else if (!intel_uc_uses_huc(...))
return NULL; /* Ditto? */
for_each_gt(gt, i915, i) {... as in the patch ...
}
int intel_pxp_init(struct drm_i915_private *i915)
{
...
if (IS_ENABLED(CONFIG_DRM_I915_PXP) && INTEL_INFO(pxp->ctrl_gt->i915)->has_pxp) pxp_init_full(pxp); else if (intel_huc_is_loaded_by_gsc(...)) intel_pxp_tee_component_init(pxp); else WARN(1, "oopsie");
...
}
bool intel_pxp_is_supported(...i915...)
{
return IS_ENABLED(CONFIG_DRM_I915_PXP) && i915->pxp;
}Regards,
Tvrtko
P.S. s/pxp_find_suitable_ctrl_gt/pxp_find_required_ctrl_gt/, to signify it may not required even if it exists?
Quoted 21 lines
pxp_init_full(pxp); } else if (pxp_backend_tee_is_needed(pxp)) { intel_pxp_tee_component_init(pxp); } else { kfree(pxp); pxp = NULL; } i915->pxp = pxp; return 0; }Quoted 4 lines
Regards,
Tvrtko
Alan:[snip]
Quoted 1 line · Tvrtko Ursulin
[Side note - your email client somehow manages to make a mess of line wraps so after a few replies it is super hard to follow the quote. Don't know how/what/why but I don't have this problem on the mailing list with other folks so at least I *think* it is something about your client or it's configuration.]
Alan: Yeah i apologize i've been struggling to find the wrong configuration - which is why i use a lot of [snip]s
Alan: [snip]
Quoted 1 line
Null check is fine, I was a bit bothered by the helpers operating on pxp. But lets put this aside for now and focus on the init path.
Alan: Okay we can come back to this on next rev if we think it deserves more scrutiny
Alan: [snip]
Quoted 2 lines
Quoted 1 line
IS_ENABLEDis always optimized away, be it 1 or 0, since it is a compile time constant. So it doesn't increase the number of runtime conditionals.
Alan: Right - my mistake.
Alan: [snip]
Quoted 7 lines
Quoted 7 lines
int
intel_pxp_init(struct drm_i915_private *i915){ intel_gt *gt; intel_pxp *pxp; /* * NOTE: Get a suitable ctrl_gt before checking intel_pxp_is_supported
Alan: ...[snip]...
Quoted 8 lines
Quoted 5 lines
/* * If HuC is loaded by GSC but PXP is disabled, we can skip the init of * the full PXP session/object management and just init the tee channel. */ if (intel_pxp_is_supported(pxp)) {How does the "full pxp init" branch handle the case of "have vdbox but huc fw is not available"? Presumably
i915->pxpis not needed on that path too then? If so that could also be folded intopxp_find_suitable_ctrl_gtand then you wouldn't need the "else kfree" branch below.
Alan: No, on legacy platforms we do support PXP context/buffers without HuC loaded. So we can't roll that in. But i get the intent.
Quoted 9 lines
Quoted 2 lines
Essentially, can you cram more of the static checks into
pxp_find_suitable_ctrl_gtand if that one returns a gt, then you definitely knowi915->pxpneeds to be allocated and just decide on the flavour of initialisation?I am not entirely sure about
has_pxpbut would this work:static struct
intel_gt*pxp_find_suitable_ctrl_gt(structdrm_i915_private*i915) {
...if (!VDBOX_MASK(...)) return NULL; /* Can't possibly need pxp */
Alan: For MTL, we will wrongly fail here if we check root gt (but must check root-gt for pre-MTL), so this check would need to go into the "for_each_gt" below to cover both.
Quoted 2 lines
else if (!intel_uc_uses_huc(...)) return NULL; /* Ditto? */
Alan: So we cant add this for the existing support legacy case as mentioned above.
Alan: [snip]
Quoted 9 lines
int
intel_pxp_init(struct drm_i915_private *i915)
{
...if (IS_ENABLED(CONFIG_DRM_I915_PXP) && INTEL_INFO(pxp->ctrl_gt->i915)->has_pxp) pxp_init_full(pxp); else if (intel_huc_is_loaded_by_gsc(...)) intel_pxp_tee_component_init(pxp); else WARN(1, "oopsie");
Alan: i get your point, we want to delay the allocation until we know for sure so don't need to free it back. I'll think about this and get a rev-11 out with the existing fixes and we can continue from there. I'm assuming keeping intel_pxp_init cleaner at the risk of rolling more of these quirky rules into helpers like find_required_gt is the preference.
Alan: [snip]
Quoted 1 line
P.S. s/pxp_find_suitable_ctrl_gt/pxp_find_required_ctrl_gt/, to signify it may not required even if it exists?
Alan: sounds good.