linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/etnaviv: correct ETNA_MAX_PIPE define
@ 2019-11-01 10:10 Christian Gmeiner
  2019-11-04  9:44 ` Lucas Stach
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Gmeiner @ 2019-11-01 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Christian Gmeiner, Dan Carpenter, stable, Lucas Stach,
	Russell King, David Airlie, Daniel Vetter, etnaviv, dri-devel

etnaviv supports the following pipe types:

ETNA_PIPE_3D      0x00
ETNA_PIPE_2D      0x01
ETNA_PIPE_VG      0x02

The current used value of 4 for ETNA_MAX_PIPES is wrong and
caueses some troubles in the combination with perf counters.

Lets have a look at the function etnaviv_pm_query_dom(..):
If domain->pipe is 3 then we are one element beyond the end
of the array.

The easiest way to fix this issue is to provide a correct value
for ETNA_MAX_PIPES.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 include/uapi/drm/etnaviv_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h
index 09d0df8b71c5..5a62228298d1 100644
--- a/include/uapi/drm/etnaviv_drm.h
+++ b/include/uapi/drm/etnaviv_drm.h
@@ -75,7 +75,7 @@ struct drm_etnaviv_timespec {
 #define ETNAVIV_PARAM_GPU_NUM_VARYINGS              0x1a
 #define ETNAVIV_PARAM_SOFTPIN_START_ADDR            0x1b
 
-#define ETNA_MAX_PIPES 4
+#define ETNA_MAX_PIPES 3
 
 struct drm_etnaviv_param {
 	__u32 pipe;           /* in */
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/etnaviv: correct ETNA_MAX_PIPE define
  2019-11-01 10:10 [PATCH] drm/etnaviv: correct ETNA_MAX_PIPE define Christian Gmeiner
@ 2019-11-04  9:44 ` Lucas Stach
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Stach @ 2019-11-04  9:44 UTC (permalink / raw)
  To: Christian Gmeiner, linux-kernel
  Cc: Dan Carpenter, stable, Russell King, David Airlie, Daniel Vetter,
	etnaviv, dri-devel

On Fr, 2019-11-01 at 11:10 +0100, Christian Gmeiner wrote:
> etnaviv supports the following pipe types:
> 
> ETNA_PIPE_3D      0x00
> ETNA_PIPE_2D      0x01
> ETNA_PIPE_VG      0x02
> 
> The current used value of 4 for ETNA_MAX_PIPES is wrong and
> caueses some troubles in the combination with perf counters.
> 
> Lets have a look at the function etnaviv_pm_query_dom(..):
> If domain->pipe is 3 then we are one element beyond the end
> of the array.
> 
> The easiest way to fix this issue is to provide a correct value
> for ETNA_MAX_PIPES.

No, this is not a correct fix. The ETNA_MAX_PIPES define does not
correspond to the pipe types, it's the number of maximum possible GPU
cores. Any code in the driver needs to deal with less GPU cores being
available than this maximum number. If it doesn't, please fix the code
instead of messing with this define.

Regards,
Lucas

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  include/uapi/drm/etnaviv_drm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/drm/etnaviv_drm.h
> b/include/uapi/drm/etnaviv_drm.h
> index 09d0df8b71c5..5a62228298d1 100644
> --- a/include/uapi/drm/etnaviv_drm.h
> +++ b/include/uapi/drm/etnaviv_drm.h
> @@ -75,7 +75,7 @@ struct drm_etnaviv_timespec {
>  #define ETNAVIV_PARAM_GPU_NUM_VARYINGS              0x1a
>  #define ETNAVIV_PARAM_SOFTPIN_START_ADDR            0x1b
>  
> -#define ETNA_MAX_PIPES 4
> +#define ETNA_MAX_PIPES 3
>  
>  struct drm_etnaviv_param {
>  	__u32 pipe;           /* in */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-04  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 10:10 [PATCH] drm/etnaviv: correct ETNA_MAX_PIPE define Christian Gmeiner
2019-11-04  9:44 ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).