Skip to contentSkip to conversation

drm/i915: workaround sparse warning on variable length arrays

PATCH RESEND In review Jani Nikula 3 participants 6 messages Oct 4, 2016

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

PATCH RESEND 1/2 drm/i915: workaround sparse warning on variable length arrays

Fix sparse warning:

drivers/gpu/drm/i915/intel_device_info.c:195:31: warning: Variable length array is used.

In truth the array does have constant length, but sparse is too dumb to realize. This is a bit ugly, but silence the warning no matter what.

Fixes 91bedd34abf0 ("drm/i915/bdw: Check for slice, subslice and EU count for BDW")
---
 drivers/gpu/drm/i915/intel_device_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_device_info.c +1 -1
index 73b6858600ac..1b20e160bc1f 100644
@@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
 	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
 	const int s_max = 3, ss_max = 3, eu_max = 8;
 	int s, ss;
-	u32 fuse2, eu_disable[s_max];
+	u32 fuse2, eu_disable[3]; /* s_max */
 
 	fuse2 = I915_READ(GEN8_FUSE2);
 	sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH RESEND 2/2 drm/i915: silence io mapping/unmapping sparse warnings on different address spaces

drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52: expected void [noderef] <asn:2>*vaddr
drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52: got void *
drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15: warning: incorrect type in assignment (different address spaces)
drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15: expected void *vaddr
drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15: got void [noderef] <asn:2>*

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
index 33c85227643d..e88786ea1219 100644
@@ -429,7 +429,7 @@ static void *reloc_iomap(struct drm_i915_gem_object *obj,
 	}
 
 	if (cache->vaddr) {
-		io_mapping_unmap_atomic(unmask_page(cache->vaddr));
+		io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr));
 	} else {
 		struct i915_vma *vma;
 		int ret;
@@ -474,7 +474,7 @@ static void *reloc_iomap(struct drm_i915_gem_object *obj,
 		offset += page << PAGE_SHIFT;
 	}
 
-	vaddr = io_mapping_map_atomic_wc(&cache->i915->ggtt.mappable, offset);
+	vaddr = (void __force *) io_mapping_map_atomic_wc(&cache->i915->ggtt.mappable, offset);
 	cache->page = page;
 	cache->vaddr = (unsigned long)vaddr;
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH RESEND 2/2] drm/i915: silence io mapping/unmapping sparse warnings on different address spaces

Quoted 9 lines · Jani Nikula

drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52: warning: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52:    expected void [noderef] <asn:2>*vaddr drivers/gpu/drm/i915/i915_gem_execbuffer.c:432:52:    got void * drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15: warning: incorrect type in assignment (different address spaces) drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15:    expected void *vaddr drivers/gpu/drm/i915/i915_gem_execbuffer.c:477:15:    got void [noderef] <asn:2>*

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Jani Nikula

drivers/gpu/drm/i915/intel_device_info.c static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) · line 193

Quoted 3 lines · Jani Nikula
drivers/gpu/drm/i915/intel_device_info.c +0 -0
@@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
  	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  	const int s_max = 3, ss_max = 3, eu_max = 8;

Does sparse shut up if you split these into their own lines?

drivers/gpu/drm/i915/intel_device_info.c static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) · line 195

Quoted 3 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -1
  	int s, ss;
-	u32 fuse2, eu_disable[s_max];
+	u32 fuse2, eu_disable[3]; /* s_max */

If not;

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 7 lines · Joonas Lahtinen

drivers/gpu/drm/i915/intel_device_info.c static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) · line 193

Quoted 3 lines · Jani Nikula
drivers/gpu/drm/i915/intel_device_info.c +0 -0
@@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
  	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
  	const int s_max = 3, ss_max = 3, eu_max = 8;

Does sparse shut up if you split these into their own lines?

Quoted 7 lines

drivers/gpu/drm/i915/intel_device_info.c static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) · line 195

Quoted 3 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -1
  	int s, ss;
-	u32 fuse2, eu_disable[s_max];
+	u32 fuse2, eu_disable[3]; /* s_max */

If not;

No go, pushed this one. Thanks for the review.

How about patch 2/2?

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✗ Fi.CI.BAT: warning for series starting with [RESEND,1/2] drm/i915: workaround sparse warning on variable length arrays

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [RESEND,1/2] drm/i915: workaround sparse warning on variable length arrays
URL : https://patchwork.freedesktop.org/series/13269/
State : warning

== Summary ==

Series 13269v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/13269/revisions/1/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900)
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (fi-skl-6700hq)
fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
fi-bxt-t5700     total:244  pass:214  dwarn:0   dfail:0   fail:0   skip:30 
fi-byt-j1900     total:244  pass:210  dwarn:2   dfail:0   fail:1   skip:31 
fi-byt-n2820     total:244  pass:208  dwarn:0   dfail:0   fail:1   skip:35 
fi-hsw-4770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-hsw-4770r     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ilk-650       total:244  pass:182  dwarn:0   dfail:0   fail:2   skip:60 
fi-ivb-3520m     total:244  pass:219  dwarn:0   dfail:0   fail:0   skip:25 
fi-ivb-3770      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6700k     total:244  pass:219  dwarn:1   dfail:0   fail:0   skip:24 
fi-skl-6770hq    total:244  pass:228  dwarn:1   dfail:0   fail:1   skip:14 
fi-snb-2520m     total:244  pass:208  dwarn:0   dfail:0   fail:0   skip:36 
fi-snb-2600      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 

Results at /archive/results/CI_IGT_test/Patchwork_2620/

cedbdecff4c878309133e066f696ea63d41cee73 drm-intel-nightly: 2016y-10m-04d-10h-53m-20s UTC integration manifest 323d3a4 drm/i915: silence io mapping/unmapping sparse warnings on different address spaces

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