All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: use unsigned long for platform_mask
@ 2019-04-02 22:21 Lucas De Marchi
  2019-04-02 23:15 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Lucas De Marchi @ 2019-04-02 22:21 UTC (permalink / raw)
  To: intel-gfx

No reason to stick to u32 for platform mask if we can just use more bits
on 64 bit platforms.

$ size drivers/gpu/drm/i915/i915.ko*
   text	   data	    bss	    dec	    hex	filename
1884779	  41334	   5408	1931521	 1d7901	drivers/gpu/drm/i915/i915.ko
1886693	  41358	   5408	1933459	 1d8093	drivers/gpu/drm/i915/i915.ko.old

Now on 64 bits we have only one long as opposed to 2 u32:

$ pahole -C intel_runtime_info drivers/gpu/drm/i915/i915.ko
struct intel_runtime_info {
	long unsigned int          platform_mask[1];     /*     0     8 */
...
}

On 32 bits we still have the same thing as before:
$ size drivers/gpu/drm/i915/i915.ko*
   text	   data	    bss	    dec	    hex	filename
1489839	  32485	   2816	1525140	 174594	drivers/gpu/drm/i915/i915.ko
1489839	  32485	   2816	1525140	 174594	drivers/gpu/drm/i915/i915.ko.old

Besides reducing the code on x86-64 now the array size is automatically
calculated and we don't have to worry about extending it anymore.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h          | 4 ----
 drivers/gpu/drm/i915/intel_device_info.h | 8 ++++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0ab4826921f7..7845a825e810 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2309,10 +2309,6 @@ __platform_mask_index(const struct intel_runtime_info *info,
 	const unsigned int pbits =
 		BITS_PER_TYPE(info->platform_mask[0]) - INTEL_SUBPLATFORM_BITS;
 
-	/* Expand the platform_mask array if this fails. */
-	BUILD_BUG_ON(INTEL_MAX_PLATFORMS >
-		     pbits * ARRAY_SIZE(info->platform_mask));
-
 	return p / pbits;
 }
 
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 0e579f158016..637d97e8314e 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -214,11 +214,11 @@ struct intel_runtime_info {
 	 * Platform mask is used for optimizing or-ed IS_PLATFORM calls into
 	 * into single runtime conditionals, and also to provide groundwork
 	 * for future per platform, or per SKU build optimizations.
-	 *
-	 * Array can be extended when necessary if the corresponding
-	 * BUILD_BUG_ON is hit.
 	 */
-	u32 platform_mask[2];
+	unsigned long platform_mask[
+		DIV_ROUND_UP(INTEL_MAX_PLATFORMS,
+			     BITS_PER_TYPE(unsigned long)
+			     - INTEL_SUBPLATFORM_BITS)];
 
 	u16 device_id;
 
-- 
2.21.0

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

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

end of thread, other threads:[~2019-04-03 19:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 22:21 [PATCH] drm/i915: use unsigned long for platform_mask Lucas De Marchi
2019-04-02 23:15 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-04-02 23:16 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-04-02 23:31   ` Lucas De Marchi
2019-04-02 23:48 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-04-03  1:46 ` [PATCH v2] " Lucas De Marchi
2019-04-03  6:57   ` Tvrtko Ursulin
2019-04-03  8:15     ` Lucas De Marchi
2019-04-03  9:25       ` Tvrtko Ursulin
2019-04-03 19:45         ` Lucas De Marchi
2019-04-03  1:54 ` ✗ Fi.CI.SPARSE: warning for drm/i915: use unsigned long for platform_mask (rev2) Patchwork
2019-04-03  2:13 ` ✓ Fi.CI.BAT: success " Patchwork
2019-04-03 17:32 ` ✓ Fi.CI.IGT: " Patchwork

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.