diff mbox series

drm/i915/pxp: fix non-optimised !CONFIG_DRM_I915_PXP build

Message ID 20241103110230.11035-1-jsg@jsg.id.au (mailing list archive)
State New
Headers show
Series drm/i915/pxp: fix non-optimised !CONFIG_DRM_I915_PXP build | expand

Commit Message

Jonathan Gray Nov. 3, 2024, 11:02 a.m. UTC
intel_pxp_gsccs_is_ready_for_sessions() is gated by CONFIG_DRM_I915_PXP
but called from intel_pxp.c which isn't.  Provide a fallback inline
function to fix the non-optimised build.

Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
 drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Jani Nikula Nov. 4, 2024, 10:16 a.m. UTC | #1
On Sun, 03 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> intel_pxp_gsccs_is_ready_for_sessions() is gated by CONFIG_DRM_I915_PXP
> but called from intel_pxp.c which isn't.  Provide a fallback inline
> function to fix the non-optimised build.

What does this have to do with optimization? Isn't the build just plain
broken for PXP=n?

BR,
Jani.


>
> Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> index 9aae779c4da3..b93488e99685 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> @@ -16,26 +16,30 @@ struct intel_pxp;
>  #define GSC_PENDING_RETRY_PAUSE_MS 50
>  #define GSCFW_MAX_ROUND_TRIP_LATENCY_MS (GSC_HECI_REPLY_LATENCY_MS + \
>  					 (GSC_PENDING_RETRY_MAXCOUNT * GSC_PENDING_RETRY_PAUSE_MS))
>  
>  #ifdef CONFIG_DRM_I915_PXP
>  void intel_pxp_gsccs_fini(struct intel_pxp *pxp);
>  int intel_pxp_gsccs_init(struct intel_pxp *pxp);
> +bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
>  
>  int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id);
>  void intel_pxp_gsccs_end_arb_fw_session(struct intel_pxp *pxp, u32 arb_session_id);
>  
>  #else
>  static inline void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
>  {
>  }
>  
>  static inline int intel_pxp_gsccs_init(struct intel_pxp *pxp)
>  {
>  	return 0;
>  }
>  
> -#endif
> +static inline bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
> +{
> +	return false;
> +}
>  
> -bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
> +#endif
>  
>  #endif /*__INTEL_PXP_GSCCS_H__ */
Jonathan Gray Nov. 4, 2024, 11:44 a.m. UTC | #2
On Mon, Nov 04, 2024 at 12:16:44PM +0200, Jani Nikula wrote:
> On Sun, 03 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> > intel_pxp_gsccs_is_ready_for_sessions() is gated by CONFIG_DRM_I915_PXP
> > but called from intel_pxp.c which isn't.  Provide a fallback inline
> > function to fix the non-optimised build.
> 
> What does this have to do with optimization? Isn't the build just plain
> broken for PXP=n?

With clang/lld 16 on OpenBSD with PXP=n, intel_pxp.o with -O0 has an
undefined reference to intel_pxp_gsccs_is_ready_for_sessions,
with -O1 and -O2 it doesn't and the kernel links.

> 
> BR,
> Jani.
> 
> 
> >
> > Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
> > Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
> > ---
> >  drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> > index 9aae779c4da3..b93488e99685 100644
> > --- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> > @@ -16,26 +16,30 @@ struct intel_pxp;
> >  #define GSC_PENDING_RETRY_PAUSE_MS 50
> >  #define GSCFW_MAX_ROUND_TRIP_LATENCY_MS (GSC_HECI_REPLY_LATENCY_MS + \
> >  					 (GSC_PENDING_RETRY_MAXCOUNT * GSC_PENDING_RETRY_PAUSE_MS))
> >  
> >  #ifdef CONFIG_DRM_I915_PXP
> >  void intel_pxp_gsccs_fini(struct intel_pxp *pxp);
> >  int intel_pxp_gsccs_init(struct intel_pxp *pxp);
> > +bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
> >  
> >  int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id);
> >  void intel_pxp_gsccs_end_arb_fw_session(struct intel_pxp *pxp, u32 arb_session_id);
> >  
> >  #else
> >  static inline void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
> >  {
> >  }
> >  
> >  static inline int intel_pxp_gsccs_init(struct intel_pxp *pxp)
> >  {
> >  	return 0;
> >  }
> >  
> > -#endif
> > +static inline bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
> > +{
> > +	return false;
> > +}
> >  
> > -bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
> > +#endif
> >  
> >  #endif /*__INTEL_PXP_GSCCS_H__ */
> 
> -- 
> Jani Nikula, Intel
>
Jani Nikula Nov. 4, 2024, 1:40 p.m. UTC | #3
On Mon, 04 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> On Mon, Nov 04, 2024 at 12:16:44PM +0200, Jani Nikula wrote:
>> On Sun, 03 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
>> > intel_pxp_gsccs_is_ready_for_sessions() is gated by CONFIG_DRM_I915_PXP
>> > but called from intel_pxp.c which isn't.  Provide a fallback inline
>> > function to fix the non-optimised build.
>> 
>> What does this have to do with optimization? Isn't the build just plain
>> broken for PXP=n?
>
> With clang/lld 16 on OpenBSD with PXP=n, intel_pxp.o with -O0 has an
> undefined reference to intel_pxp_gsccs_is_ready_for_sessions,
> with -O1 and -O2 it doesn't and the kernel links.

Right, so it can determine intel_pxp_get_readiness_status() is basically
a nop for PXP=n.

BR,
Jani.


>
>> 
>> BR,
>> Jani.
>> 
>> 
>> >
>> > Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
>> > Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
>> > ---
>> >  drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h | 8 ++++++--
>> >  1 file changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
>> > index 9aae779c4da3..b93488e99685 100644
>> > --- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
>> > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
>> > @@ -16,26 +16,30 @@ struct intel_pxp;
>> >  #define GSC_PENDING_RETRY_PAUSE_MS 50
>> >  #define GSCFW_MAX_ROUND_TRIP_LATENCY_MS (GSC_HECI_REPLY_LATENCY_MS + \
>> >  					 (GSC_PENDING_RETRY_MAXCOUNT * GSC_PENDING_RETRY_PAUSE_MS))
>> >  
>> >  #ifdef CONFIG_DRM_I915_PXP
>> >  void intel_pxp_gsccs_fini(struct intel_pxp *pxp);
>> >  int intel_pxp_gsccs_init(struct intel_pxp *pxp);
>> > +bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
>> >  
>> >  int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id);
>> >  void intel_pxp_gsccs_end_arb_fw_session(struct intel_pxp *pxp, u32 arb_session_id);
>> >  
>> >  #else
>> >  static inline void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
>> >  {
>> >  }
>> >  
>> >  static inline int intel_pxp_gsccs_init(struct intel_pxp *pxp)
>> >  {
>> >  	return 0;
>> >  }
>> >  
>> > -#endif
>> > +static inline bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
>> > +{
>> > +	return false;
>> > +}
>> >  
>> > -bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
>> > +#endif
>> >  
>> >  #endif /*__INTEL_PXP_GSCCS_H__ */
>> 
>> -- 
>> Jani Nikula, Intel
>>
Jani Nikula Nov. 5, 2024, 9:23 a.m. UTC | #4
On Sun, 03 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> intel_pxp_gsccs_is_ready_for_sessions() is gated by CONFIG_DRM_I915_PXP
> but called from intel_pxp.c which isn't.  Provide a fallback inline
> function to fix the non-optimised build.
>
> Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> index 9aae779c4da3..b93488e99685 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
> @@ -16,26 +16,30 @@ struct intel_pxp;
>  #define GSC_PENDING_RETRY_PAUSE_MS 50
>  #define GSCFW_MAX_ROUND_TRIP_LATENCY_MS (GSC_HECI_REPLY_LATENCY_MS + \
>  					 (GSC_PENDING_RETRY_MAXCOUNT * GSC_PENDING_RETRY_PAUSE_MS))
>  
>  #ifdef CONFIG_DRM_I915_PXP
>  void intel_pxp_gsccs_fini(struct intel_pxp *pxp);
>  int intel_pxp_gsccs_init(struct intel_pxp *pxp);
> +bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
>  
>  int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id);
>  void intel_pxp_gsccs_end_arb_fw_session(struct intel_pxp *pxp, u32 arb_session_id);
>  
>  #else
>  static inline void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
>  {
>  }
>  
>  static inline int intel_pxp_gsccs_init(struct intel_pxp *pxp)
>  {
>  	return 0;
>  }
>  
> -#endif
> +static inline bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
> +{
> +	return false;
> +}
>  
> -bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
> +#endif
>  
>  #endif /*__INTEL_PXP_GSCCS_H__ */
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
index 9aae779c4da3..b93488e99685 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h
@@ -16,26 +16,30 @@  struct intel_pxp;
 #define GSC_PENDING_RETRY_PAUSE_MS 50
 #define GSCFW_MAX_ROUND_TRIP_LATENCY_MS (GSC_HECI_REPLY_LATENCY_MS + \
 					 (GSC_PENDING_RETRY_MAXCOUNT * GSC_PENDING_RETRY_PAUSE_MS))
 
 #ifdef CONFIG_DRM_I915_PXP
 void intel_pxp_gsccs_fini(struct intel_pxp *pxp);
 int intel_pxp_gsccs_init(struct intel_pxp *pxp);
+bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
 
 int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id);
 void intel_pxp_gsccs_end_arb_fw_session(struct intel_pxp *pxp, u32 arb_session_id);
 
 #else
 static inline void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
 {
 }
 
 static inline int intel_pxp_gsccs_init(struct intel_pxp *pxp)
 {
 	return 0;
 }
 
-#endif
+static inline bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
+{
+	return false;
+}
 
-bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp);
+#endif
 
 #endif /*__INTEL_PXP_GSCCS_H__ */