Skip to contentSkip to conversation

amdgpu/dc: don't check for 0 on register read/writes always.

PATCH In review Dave Airlie 2 participants 2 messages Sep 28, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu/dc: don't check for 0 on register read/writes always.

From: Dave Airlie <[email protected]>

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
---
 drivers/gpu/drm/amd/display/dc/dm_services.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dm_services.h +7 -2
index 8ab0af6..c976e2a 100644
@@ -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);
 }
 
Signature · 6 lines
2.9.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170928024201.20549-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 10 lines · Dave Airlie

From: Dave Airlie <[email protected]>

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
Quoted 9 lines
---
 drivers/gpu/drm/amd/display/dc/dm_services.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dm_services.h +0 -0
index 8ab0af6..c976e2a 100644

drivers/gpu/drm/amd/display/dc/dm_services.h irq_handler_idx dm_register_interrupt( · line 101

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dm_services.h +3 -0
@@ -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

Quoted 22 lines
drivers/gpu/drm/amd/display/dc/dm_services.h +2 -2
 #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)

drivers/gpu/drm/amd/display/dc/dm_services.h static inline void dm_write_reg_func( · line 139

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dm_services.h +2 -0
 {
+#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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx