All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] amdgpu/dc: don't check for 0 on register read/writes always.
@ 2017-09-28  2:42 Dave Airlie
       [not found] ` <20170928024201.20549-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2017-09-28  2:42 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This adds ~50k to the driver text segment, and 10k to data segment.

   text	   data	    bss	    dec	    hex	filename
2385556	  39681	   1045	2426282	 2505aa	drivers/gpu/drm/amd/amdgpu/amdgpu.o
  text	   data	    bss	    dec	    hex	filename
2336593	  28857	   1045	2366495	 241c1f	drivers/gpu/drm/amd/amdgpu/amdgpu.o

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dm_services.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dm_services.h b/drivers/gpu/drm/amd/display/dc/dm_services.h
index 8ab0af6..c976e2a 100644
--- a/drivers/gpu/drm/amd/display/dc/dm_services.h
+++ b/drivers/gpu/drm/amd/display/dc/dm_services.h
@@ -96,6 +96,9 @@ irq_handler_idx dm_register_interrupt(
  *
  */
 
+/* enable for debugging new code, this adds 50k to the driver size. */
+/* #define DM_CHECK_ADDR_0 */
+
 #define dm_read_reg(ctx, address)	\
 		dm_read_reg_func(ctx, address, __func__)
 
@@ -105,12 +108,12 @@ static inline uint32_t dm_read_reg_func(
 	const char *func_name)
 {
 	uint32_t value;
-
+#ifdef DM_CHECK_ADDR_0
 	if (address == 0) {
 		DC_ERR("invalid register read; address = 0\n");
 		return 0;
 	}
-
+#endif
 	value = cgs_read_register(ctx->cgs_device, address);
 
 	return value;
@@ -125,10 +128,12 @@ static inline void dm_write_reg_func(
 	uint32_t value,
 	const char *func_name)
 {
+#ifdef DM_CHECK_ADDR_0
 	if (address == 0) {
 		DC_ERR("invalid register write. address = 0");
 		return;
 	}
+#endif
 	cgs_write_register(ctx->cgs_device, address, value);
 }
 
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] amdgpu/dc: don't check for 0 on register read/writes always.
       [not found] ` <20170928024201.20549-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-28 15:55   ` Harry Wentland
  0 siblings, 0 replies; 2+ messages in thread
From: Harry Wentland @ 2017-09-28 15:55 UTC (permalink / raw)
  To: Dave Airlie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2017-09-27 10:42 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This adds ~50k to the driver text segment, and 10k to data segment.
> 
>    text	   data	    bss	    dec	    hex	filename
> 2385556	  39681	   1045	2426282	 2505aa	drivers/gpu/drm/amd/amdgpu/amdgpu.o
>   text	   data	    bss	    dec	    hex	filename
> 2336593	  28857	   1045	2366495	 241c1f	drivers/gpu/drm/amd/amdgpu/amdgpu.o
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

> ---
>  drivers/gpu/drm/amd/display/dc/dm_services.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dm_services.h b/drivers/gpu/drm/amd/display/dc/dm_services.h
> index 8ab0af6..c976e2a 100644
> --- a/drivers/gpu/drm/amd/display/dc/dm_services.h
> +++ b/drivers/gpu/drm/amd/display/dc/dm_services.h
> @@ -96,6 +96,9 @@ irq_handler_idx dm_register_interrupt(
>   *
>   */
>  
> +/* enable for debugging new code, this adds 50k to the driver size. */
> +/* #define DM_CHECK_ADDR_0 */
> +

I like this approach. It allows us to also set it on internal builds for
dev teams.

Harry

>  #define dm_read_reg(ctx, address)	\
>  		dm_read_reg_func(ctx, address, __func__)
>  
> @@ -105,12 +108,12 @@ static inline uint32_t dm_read_reg_func(
>  	const char *func_name)
>  {
>  	uint32_t value;
> -
> +#ifdef DM_CHECK_ADDR_0
>  	if (address == 0) {
>  		DC_ERR("invalid register read; address = 0\n");
>  		return 0;
>  	}
> -
> +#endif
>  	value = cgs_read_register(ctx->cgs_device, address);
>  
>  	return value;
> @@ -125,10 +128,12 @@ static inline void dm_write_reg_func(
>  	uint32_t value,
>  	const char *func_name)
>  {
> +#ifdef DM_CHECK_ADDR_0
>  	if (address == 0) {
>  		DC_ERR("invalid register write. address = 0");
>  		return;
>  	}
> +#endif
>  	cgs_write_register(ctx->cgs_device, address, value);
>  }
>  
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2017-09-28 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-28  2:42 [PATCH] amdgpu/dc: don't check for 0 on register read/writes always Dave Airlie
     [not found] ` <20170928024201.20549-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-28 15:55   ` Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.