Re: [Intel-gfx] [PATCH] drm/i915/pxp: Trybot - run CI with PXP and MEI_PXP enabled

2021-11-22 Thread Rodrigo Vivi
On Mon, Nov 22, 2021 at 09:57:30AM +0530, Tejas Upadhyay wrote:
> Please do not merge this is trybot patch to run CI with PXP
> and MEI PXP enabled to get premegre results for
> https://patchwork.freedesktop.org/series/96658/#rev3 change.

Please don't send this kind of tests to intel-gfx ml.

Please use the actual try-bot ml:

https://lists.freedesktop.org/mailman/listinfo/intel-gfx-trybot

and check the results at:

https://patchwork.freedesktop.org/project/intel-gfx-trybot/series/?ordering=-last_updated

Thanks,
Rodrigo.

> 
> Signed-off-by: Tejas Upadhyay 
> ---
>  drivers/gpu/drm/i915/Kconfig.debug  |  2 ++
>  drivers/gpu/drm/i915/gt/intel_gt_pm.c   |  7 +++--
>  drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 37 +
>  drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 19 +++--
>  4 files changed, 48 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/Kconfig.debug 
> b/drivers/gpu/drm/i915/Kconfig.debug
> index e7fd3e76f8a2..fa181693184b 100644
> --- a/drivers/gpu/drm/i915/Kconfig.debug
> +++ b/drivers/gpu/drm/i915/Kconfig.debug
> @@ -48,6 +48,8 @@ config DRM_I915_DEBUG
>   select DRM_I915_DEBUG_RUNTIME_PM
>   select DRM_I915_SW_FENCE_DEBUG_OBJECTS
>   select DRM_I915_SELFTEST
> + select INTEL_MEI_PXP # used by igt/gem_pxp
> + select DRM_I915_PXP # used by igt/gem_pxp
>   select BROKEN # for prototype uAPI
>   default n
>   help
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c 
> b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> index b4a8594bc46c..c0fa41e4c803 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> @@ -303,7 +303,7 @@ void intel_gt_suspend_prepare(struct intel_gt *gt)
>   user_forcewake(gt, true);
>   wait_for_suspend(gt);
>  
> - intel_pxp_suspend(>->pxp, false);
> + intel_pxp_suspend_prepare(>->pxp);
>  }
>  
>  static suspend_state_t pm_suspend_target(void)
> @@ -328,6 +328,7 @@ 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
> @@ -355,7 +356,7 @@ void intel_gt_suspend_late(struct intel_gt *gt)
>  
>  void intel_gt_runtime_suspend(struct intel_gt *gt)
>  {
> - intel_pxp_suspend(>->pxp, true);
> + intel_pxp_runtime_suspend(>->pxp);
>   intel_uc_runtime_suspend(>->uc);
>  
>   GT_TRACE(gt, "\n");
> @@ -373,7 +374,7 @@ int intel_gt_runtime_resume(struct intel_gt *gt)
>   if (ret)
>   return ret;
>  
> - intel_pxp_resume(>->pxp);
> + intel_pxp_runtime_resume(>->pxp);
>  
>   return 0;
>  }
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c 
> b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> index 23fd86de5a24..6a7d4e2ee138 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> @@ -7,26 +7,29 @@
>  #include "intel_pxp_irq.h"
>  #include "intel_pxp_pm.h"
>  #include "intel_pxp_session.h"
> +#include "i915_drv.h"
>  
> -void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime)
> +void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
>  {
>   if (!intel_pxp_is_enabled(pxp))
>   return;
>  
>   pxp->arb_is_valid = false;
>  
> - /*
> -  * Contexts using protected objects keep a runtime PM reference, so we
> -  * can only runtime suspend when all of them have been either closed
> -  * or banned. Therefore, there is no need to invalidate in that
> -  * scenario.
> -  */
> - if (!runtime)
> - intel_pxp_invalidate(pxp);
> + intel_pxp_invalidate(pxp);
> +}
>  
> - intel_pxp_fini_hw(pxp);
> +void intel_pxp_suspend(struct intel_pxp *pxp)
> +{
> + intel_wakeref_t wakeref;
>  
> - pxp->hw_state_invalidated = false;
> + if (!intel_pxp_is_enabled(pxp))
> + return;
> +
> + with_intel_runtime_pm(&pxp_to_gt(pxp)->i915->runtime_pm, wakeref) {
> + intel_pxp_fini_hw(pxp);
> + pxp->hw_state_invalidated = false;
> + }
>  }
>  
>  void intel_pxp_resume(struct intel_pxp *pxp)
> @@ -44,3 +47,15 @@ void intel_pxp_resume(struct intel_pxp *pxp)
>  
>   intel_pxp_init_hw(pxp);
>  }
> +
> +void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
> +{
> + if (!intel_pxp_is_enabled(pxp))
> + return;
> +
> + pxp->arb_is_valid = false;
> +
> + intel_pxp_fini_hw(pxp);
> +
> + pxp->hw_state_invalidated = false;
> +}
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h 
> b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> index c89e97a0c3d0..16990a3f2f85 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> @@ -9,16 +9,29 @@
>  #include "intel_pxp_types.h"
>  
>  #ifdef CONFIG_DRM_I915_PXP
> -void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime);
> +void intel_pxp_suspend_prepare(struct intel_pxp *pxp);
> +void i

[Intel-gfx] [PATCH] drm/i915/pxp: Trybot - run CI with PXP and MEI_PXP enabled

2021-11-21 Thread Tejas Upadhyay
Please do not merge this is trybot patch to run CI with PXP
and MEI PXP enabled to get premegre results for
https://patchwork.freedesktop.org/series/96658/#rev3 change.

Signed-off-by: Tejas Upadhyay 
---
 drivers/gpu/drm/i915/Kconfig.debug  |  2 ++
 drivers/gpu/drm/i915/gt/intel_gt_pm.c   |  7 +++--
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 37 +
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 19 +++--
 4 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig.debug 
b/drivers/gpu/drm/i915/Kconfig.debug
index e7fd3e76f8a2..fa181693184b 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -48,6 +48,8 @@ config DRM_I915_DEBUG
select DRM_I915_DEBUG_RUNTIME_PM
select DRM_I915_SW_FENCE_DEBUG_OBJECTS
select DRM_I915_SELFTEST
+   select INTEL_MEI_PXP # used by igt/gem_pxp
+   select DRM_I915_PXP # used by igt/gem_pxp
select BROKEN # for prototype uAPI
default n
help
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index b4a8594bc46c..c0fa41e4c803 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -303,7 +303,7 @@ void intel_gt_suspend_prepare(struct intel_gt *gt)
user_forcewake(gt, true);
wait_for_suspend(gt);
 
-   intel_pxp_suspend(>->pxp, false);
+   intel_pxp_suspend_prepare(>->pxp);
 }
 
 static suspend_state_t pm_suspend_target(void)
@@ -328,6 +328,7 @@ 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
@@ -355,7 +356,7 @@ void intel_gt_suspend_late(struct intel_gt *gt)
 
 void intel_gt_runtime_suspend(struct intel_gt *gt)
 {
-   intel_pxp_suspend(>->pxp, true);
+   intel_pxp_runtime_suspend(>->pxp);
intel_uc_runtime_suspend(>->uc);
 
GT_TRACE(gt, "\n");
@@ -373,7 +374,7 @@ int intel_gt_runtime_resume(struct intel_gt *gt)
if (ret)
return ret;
 
-   intel_pxp_resume(>->pxp);
+   intel_pxp_runtime_resume(>->pxp);
 
return 0;
 }
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
index 23fd86de5a24..6a7d4e2ee138 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
@@ -7,26 +7,29 @@
 #include "intel_pxp_irq.h"
 #include "intel_pxp_pm.h"
 #include "intel_pxp_session.h"
+#include "i915_drv.h"
 
-void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime)
+void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
 {
if (!intel_pxp_is_enabled(pxp))
return;
 
pxp->arb_is_valid = false;
 
-   /*
-* Contexts using protected objects keep a runtime PM reference, so we
-* can only runtime suspend when all of them have been either closed
-* or banned. Therefore, there is no need to invalidate in that
-* scenario.
-*/
-   if (!runtime)
-   intel_pxp_invalidate(pxp);
+   intel_pxp_invalidate(pxp);
+}
 
-   intel_pxp_fini_hw(pxp);
+void intel_pxp_suspend(struct intel_pxp *pxp)
+{
+   intel_wakeref_t wakeref;
 
-   pxp->hw_state_invalidated = false;
+   if (!intel_pxp_is_enabled(pxp))
+   return;
+
+   with_intel_runtime_pm(&pxp_to_gt(pxp)->i915->runtime_pm, wakeref) {
+   intel_pxp_fini_hw(pxp);
+   pxp->hw_state_invalidated = false;
+   }
 }
 
 void intel_pxp_resume(struct intel_pxp *pxp)
@@ -44,3 +47,15 @@ void intel_pxp_resume(struct intel_pxp *pxp)
 
intel_pxp_init_hw(pxp);
 }
+
+void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
+{
+   if (!intel_pxp_is_enabled(pxp))
+   return;
+
+   pxp->arb_is_valid = false;
+
+   intel_pxp_fini_hw(pxp);
+
+   pxp->hw_state_invalidated = false;
+}
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
index c89e97a0c3d0..16990a3f2f85 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
@@ -9,16 +9,29 @@
 #include "intel_pxp_types.h"
 
 #ifdef CONFIG_DRM_I915_PXP
-void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime);
+void intel_pxp_suspend_prepare(struct intel_pxp *pxp);
+void intel_pxp_suspend(struct intel_pxp *pxp);
 void intel_pxp_resume(struct intel_pxp *pxp);
+void intel_pxp_runtime_suspend(struct intel_pxp *pxp);
 #else
-static inline void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime)
+static inline void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
+{
+}
+
+static inline void intel_pxp_suspend(struct intel_pxp *pxp)
 {
 }
 
 static inline void intel_pxp_resume(struct intel_pxp *pxp)
 {
 }
-#endif
 
+static inline void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
+{
+}
+#endif