dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
       [not found] <20220405151517.29753-1-bp@alien8.de>
@ 2022-04-05 15:15 ` Borislav Petkov
  2022-04-25 18:46   ` Randy Dunlap
  2022-04-05 15:15 ` [PATCH 11/11] drm/i915: " Borislav Petkov
  1 sibling, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2022-04-05 15:15 UTC (permalink / raw)
  To: LKML; +Cc: David Airlie, Alex Deucher, dri-devel

From: Borislav Petkov <bp@suse.de>

Fix:

  drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
  drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
    case R128_PM4_64BM_64VCBM_64INDBM:
    ^~~~
  drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
    case R128_PM4_64PIO_64VCPIO_64INDPIO:
    ^~~~

See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/r128/r128_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
index 2e1bc01aa5c9..970e192b0d51 100644
--- a/drivers/gpu/drm/r128/r128_drv.h
+++ b/drivers/gpu/drm/r128/r128_drv.h
@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
 #	define R128_PM4_64PIO_128INDBM		(5  << 28)
 #	define R128_PM4_64BM_128INDBM		(6  << 28)
 #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
-#	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
-#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
+#	define R128_PM4_64BM_64VCBM_64INDBM	(8U  << 28)
+#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15U << 28)
 #	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
 
 #define R128_PM4_BUFFER_WM_CNTL		0x0708
-- 
2.35.1


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

* [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
       [not found] <20220405151517.29753-1-bp@alien8.de>
  2022-04-05 15:15 ` [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
@ 2022-04-05 15:15 ` Borislav Petkov
  2022-05-17 23:05   ` Randy Dunlap
  1 sibling, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2022-04-05 15:15 UTC (permalink / raw)
  To: LKML; +Cc: Tvrtko Ursulin, David Airlie, intel-gfx, dri-devel, Rodrigo Vivi

From: Borislav Petkov <bp@suse.de>

Fix:

  In file included from <command-line>:0:0:
  drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
  ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
  declared with attribute error: FIELD_PREP: mask is not constant
    _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

and other build errors due to shift overflowing values.

See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
 .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h   |  2 +-
 .../i915/gt/uc/abi/guc_communication_ctb_abi.h |  2 +-
 .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h  |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h     |  2 +-
 drivers/gpu/drm/i915/i915_reg.h                | 18 +++++++++---------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
index 7afdadc7656f..e835f28c0020 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
@@ -50,7 +50,7 @@
 
 #define HOST2GUC_SELF_CFG_REQUEST_MSG_LEN		(GUC_HXG_REQUEST_MSG_MIN_LEN + 3u)
 #define HOST2GUC_SELF_CFG_REQUEST_MSG_0_MBZ		GUC_HXG_REQUEST_MSG_0_DATA0
-#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY		(0xffff << 16)
+#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY		(0xffffU << 16)
 #define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN		(0xffff << 0)
 #define HOST2GUC_SELF_CFG_REQUEST_MSG_2_VALUE32		GUC_HXG_REQUEST_MSG_n_DATAn
 #define HOST2GUC_SELF_CFG_REQUEST_MSG_3_VALUE64		GUC_HXG_REQUEST_MSG_n_DATAn
diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
index c9086a600bce..df83c1cc7c7a 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
@@ -82,7 +82,7 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);
 #define GUC_CTB_HDR_LEN				1u
 #define GUC_CTB_MSG_MIN_LEN			GUC_CTB_HDR_LEN
 #define GUC_CTB_MSG_MAX_LEN			256u
-#define GUC_CTB_MSG_0_FENCE			(0xffff << 16)
+#define GUC_CTB_MSG_0_FENCE			(0xffffU << 16)
 #define GUC_CTB_MSG_0_FORMAT			(0xf << 12)
 #define   GUC_CTB_FORMAT_HXG			0u
 #define GUC_CTB_MSG_0_RESERVED			(0xf << 8)
diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
index 29ac823acd4c..7d5ba4d97d70 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
@@ -40,7 +40,7 @@
  */
 
 #define GUC_HXG_MSG_MIN_LEN			1u
-#define GUC_HXG_MSG_0_ORIGIN			(0x1 << 31)
+#define GUC_HXG_MSG_0_ORIGIN			(0x1U << 31)
 #define   GUC_HXG_ORIGIN_HOST			0u
 #define   GUC_HXG_ORIGIN_GUC			1u
 #define GUC_HXG_MSG_0_TYPE			(0x7 << 28)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
index 66027a42cda9..ad570fa002a6 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
@@ -28,7 +28,7 @@
 #define   GS_MIA_HALT_REQUESTED		  (0x02 << GS_MIA_SHIFT)
 #define   GS_MIA_ISR_ENTRY		  (0x04 << GS_MIA_SHIFT)
 #define   GS_AUTH_STATUS_SHIFT		30
-#define   GS_AUTH_STATUS_MASK		  (0x03 << GS_AUTH_STATUS_SHIFT)
+#define   GS_AUTH_STATUS_MASK		  (0x03U << GS_AUTH_STATUS_SHIFT)
 #define   GS_AUTH_STATUS_BAD		  (0x01 << GS_AUTH_STATUS_SHIFT)
 #define   GS_AUTH_STATUS_GOOD		  (0x02 << GS_AUTH_STATUS_SHIFT)
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3c87d77d2cf6..f3ba3d0a430b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7555,19 +7555,19 @@ enum skl_power_gate {
 #define  PORT_CLK_SEL_LCPLL_810		(2 << 29)
 #define  PORT_CLK_SEL_SPLL		(3 << 29)
 #define  PORT_CLK_SEL_WRPLL(pll)	(((pll) + 4) << 29)
-#define  PORT_CLK_SEL_WRPLL1		(4 << 29)
-#define  PORT_CLK_SEL_WRPLL2		(5 << 29)
-#define  PORT_CLK_SEL_NONE		(7 << 29)
-#define  PORT_CLK_SEL_MASK		(7 << 29)
+#define  PORT_CLK_SEL_WRPLL1		(4U << 29)
+#define  PORT_CLK_SEL_WRPLL2		(5U << 29)
+#define  PORT_CLK_SEL_NONE		(7U << 29)
+#define  PORT_CLK_SEL_MASK		(7U << 29)
 
 /* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */
 #define DDI_CLK_SEL(port)		PORT_CLK_SEL(port)
 #define  DDI_CLK_SEL_NONE		(0x0 << 28)
-#define  DDI_CLK_SEL_MG			(0x8 << 28)
-#define  DDI_CLK_SEL_TBT_162		(0xC << 28)
-#define  DDI_CLK_SEL_TBT_270		(0xD << 28)
-#define  DDI_CLK_SEL_TBT_540		(0xE << 28)
-#define  DDI_CLK_SEL_TBT_810		(0xF << 28)
+#define  DDI_CLK_SEL_MG			(0x8U << 28)
+#define  DDI_CLK_SEL_TBT_162		(0xCU << 28)
+#define  DDI_CLK_SEL_TBT_270		(0xDU << 28)
+#define  DDI_CLK_SEL_TBT_540		(0xEU << 28)
+#define  DDI_CLK_SEL_TBT_810		(0xFU << 28)
 #define  DDI_CLK_SEL_MASK		(0xF << 28)
 
 /* Transcoder clock selection */
-- 
2.35.1


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

* Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
  2022-04-05 15:15 ` [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
@ 2022-04-25 18:46   ` Randy Dunlap
  2022-05-19 13:05     ` Daniel Vetter
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2022-04-25 18:46 UTC (permalink / raw)
  To: Borislav Petkov, LKML; +Cc: David Airlie, Alex Deucher, dri-devel



On 4/5/22 08:15, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Fix:
> 
>   drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
>   drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
>     case R128_PM4_64BM_64VCBM_64INDBM:
>     ^~~~
>   drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
>     case R128_PM4_64PIO_64VCPIO_64INDPIO:
>     ^~~~
> 
> See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
> details as to why it triggers with older gccs only.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: dri-devel@lists.freedesktop.org

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  drivers/gpu/drm/r128/r128_drv.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
> index 2e1bc01aa5c9..970e192b0d51 100644
> --- a/drivers/gpu/drm/r128/r128_drv.h
> +++ b/drivers/gpu/drm/r128/r128_drv.h
> @@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
>  #	define R128_PM4_64PIO_128INDBM		(5  << 28)
>  #	define R128_PM4_64BM_128INDBM		(6  << 28)
>  #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
> -#	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
> -#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
> +#	define R128_PM4_64BM_64VCBM_64INDBM	(8U  << 28)
> +#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15U << 28)
>  #	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
>  
>  #define R128_PM4_BUFFER_WM_CNTL		0x0708

-- 
~Randy

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

* Re: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
  2022-04-05 15:15 ` [PATCH 11/11] drm/i915: " Borislav Petkov
@ 2022-05-17 23:05   ` Randy Dunlap
  2022-05-18  7:44     ` Borislav Petkov
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2022-05-17 23:05 UTC (permalink / raw)
  To: Borislav Petkov, LKML
  Cc: Tvrtko Ursulin, David Airlie, intel-gfx, dri-devel, Rodrigo Vivi



On 4/5/22 08:15, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Fix:
> 
>   In file included from <command-line>:0:0:
>   drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
>   ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
>   declared with attribute error: FIELD_PREP: mask is not constant
>     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> 
> and other build errors due to shift overflowing values.
> 
> See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
> details as to why it triggers with older gccs only.
> 

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>

Is this merged anywhere?
It could/should at least be in linux-next so that other people
don't waste time on it.

thanks.

> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> ---
>  .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h   |  2 +-
>  .../i915/gt/uc/abi/guc_communication_ctb_abi.h |  2 +-
>  .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h  |  2 +-
>  drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h     |  2 +-
>  drivers/gpu/drm/i915/i915_reg.h                | 18 +++++++++---------
>  5 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
> index 7afdadc7656f..e835f28c0020 100644
> --- a/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
> +++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
> @@ -50,7 +50,7 @@
>  
>  #define HOST2GUC_SELF_CFG_REQUEST_MSG_LEN		(GUC_HXG_REQUEST_MSG_MIN_LEN + 3u)
>  #define HOST2GUC_SELF_CFG_REQUEST_MSG_0_MBZ		GUC_HXG_REQUEST_MSG_0_DATA0
> -#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY		(0xffff << 16)
> +#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY		(0xffffU << 16)
>  #define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN		(0xffff << 0)
>  #define HOST2GUC_SELF_CFG_REQUEST_MSG_2_VALUE32		GUC_HXG_REQUEST_MSG_n_DATAn
>  #define HOST2GUC_SELF_CFG_REQUEST_MSG_3_VALUE64		GUC_HXG_REQUEST_MSG_n_DATAn
> diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
> index c9086a600bce..df83c1cc7c7a 100644
> --- a/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
> +++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
> @@ -82,7 +82,7 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);
>  #define GUC_CTB_HDR_LEN				1u
>  #define GUC_CTB_MSG_MIN_LEN			GUC_CTB_HDR_LEN
>  #define GUC_CTB_MSG_MAX_LEN			256u
> -#define GUC_CTB_MSG_0_FENCE			(0xffff << 16)
> +#define GUC_CTB_MSG_0_FENCE			(0xffffU << 16)
>  #define GUC_CTB_MSG_0_FORMAT			(0xf << 12)
>  #define   GUC_CTB_FORMAT_HXG			0u
>  #define GUC_CTB_MSG_0_RESERVED			(0xf << 8)
> diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> index 29ac823acd4c..7d5ba4d97d70 100644
> --- a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> +++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> @@ -40,7 +40,7 @@
>   */
>  
>  #define GUC_HXG_MSG_MIN_LEN			1u
> -#define GUC_HXG_MSG_0_ORIGIN			(0x1 << 31)
> +#define GUC_HXG_MSG_0_ORIGIN			(0x1U << 31)
>  #define   GUC_HXG_ORIGIN_HOST			0u
>  #define   GUC_HXG_ORIGIN_GUC			1u
>  #define GUC_HXG_MSG_0_TYPE			(0x7 << 28)
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
> index 66027a42cda9..ad570fa002a6 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h
> @@ -28,7 +28,7 @@
>  #define   GS_MIA_HALT_REQUESTED		  (0x02 << GS_MIA_SHIFT)
>  #define   GS_MIA_ISR_ENTRY		  (0x04 << GS_MIA_SHIFT)
>  #define   GS_AUTH_STATUS_SHIFT		30
> -#define   GS_AUTH_STATUS_MASK		  (0x03 << GS_AUTH_STATUS_SHIFT)
> +#define   GS_AUTH_STATUS_MASK		  (0x03U << GS_AUTH_STATUS_SHIFT)
>  #define   GS_AUTH_STATUS_BAD		  (0x01 << GS_AUTH_STATUS_SHIFT)
>  #define   GS_AUTH_STATUS_GOOD		  (0x02 << GS_AUTH_STATUS_SHIFT)
>  
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 3c87d77d2cf6..f3ba3d0a430b 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7555,19 +7555,19 @@ enum skl_power_gate {
>  #define  PORT_CLK_SEL_LCPLL_810		(2 << 29)
>  #define  PORT_CLK_SEL_SPLL		(3 << 29)
>  #define  PORT_CLK_SEL_WRPLL(pll)	(((pll) + 4) << 29)
> -#define  PORT_CLK_SEL_WRPLL1		(4 << 29)
> -#define  PORT_CLK_SEL_WRPLL2		(5 << 29)
> -#define  PORT_CLK_SEL_NONE		(7 << 29)
> -#define  PORT_CLK_SEL_MASK		(7 << 29)
> +#define  PORT_CLK_SEL_WRPLL1		(4U << 29)
> +#define  PORT_CLK_SEL_WRPLL2		(5U << 29)
> +#define  PORT_CLK_SEL_NONE		(7U << 29)
> +#define  PORT_CLK_SEL_MASK		(7U << 29)
>  
>  /* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */
>  #define DDI_CLK_SEL(port)		PORT_CLK_SEL(port)
>  #define  DDI_CLK_SEL_NONE		(0x0 << 28)
> -#define  DDI_CLK_SEL_MG			(0x8 << 28)
> -#define  DDI_CLK_SEL_TBT_162		(0xC << 28)
> -#define  DDI_CLK_SEL_TBT_270		(0xD << 28)
> -#define  DDI_CLK_SEL_TBT_540		(0xE << 28)
> -#define  DDI_CLK_SEL_TBT_810		(0xF << 28)
> +#define  DDI_CLK_SEL_MG			(0x8U << 28)
> +#define  DDI_CLK_SEL_TBT_162		(0xCU << 28)
> +#define  DDI_CLK_SEL_TBT_270		(0xDU << 28)
> +#define  DDI_CLK_SEL_TBT_540		(0xEU << 28)
> +#define  DDI_CLK_SEL_TBT_810		(0xFU << 28)
>  #define  DDI_CLK_SEL_MASK		(0xF << 28)
>  
>  /* Transcoder clock selection */

-- 
~Randy

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

* Re: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
  2022-05-17 23:05   ` Randy Dunlap
@ 2022-05-18  7:44     ` Borislav Petkov
  2022-05-18 11:39       ` Jani Nikula
  0 siblings, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2022-05-18  7:44 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Tvrtko Ursulin, David Airlie, intel-gfx, LKML, dri-devel,
	Rodrigo Vivi

On Tue, May 17, 2022 at 04:05:46PM -0700, Randy Dunlap wrote:
> 
> 
> On 4/5/22 08:15, Borislav Petkov wrote:
> > From: Borislav Petkov <bp@suse.de>
> > 
> > Fix:
> > 
> >   In file included from <command-line>:0:0:
> >   drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
> >   ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
> >   declared with attribute error: FIELD_PREP: mask is not constant
> >     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> > 
> > and other build errors due to shift overflowing values.
> > 
> > See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
> > details as to why it triggers with older gccs only.
> > 
> 
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> 
> Is this merged anywhere?

It's state is "new" in their patchwork:

https://patchwork.freedesktop.org/patch/480756/

so I guess not yet.

> It could/should at least be in linux-next so that other people
> don't waste time on it.

-ETOOMANYPATCHES I guess. :-\

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
  2022-05-18  7:44     ` Borislav Petkov
@ 2022-05-18 11:39       ` Jani Nikula
  0 siblings, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2022-05-18 11:39 UTC (permalink / raw)
  To: Borislav Petkov, Randy Dunlap
  Cc: Tvrtko Ursulin, David Airlie, intel-gfx, LKML, dri-devel,
	Rodrigo Vivi

On Wed, 18 May 2022, Borislav Petkov <bp@alien8.de> wrote:
> On Tue, May 17, 2022 at 04:05:46PM -0700, Randy Dunlap wrote:
>> 
>> 
>> On 4/5/22 08:15, Borislav Petkov wrote:
>> > From: Borislav Petkov <bp@suse.de>
>> > 
>> > Fix:
>> > 
>> >   In file included from <command-line>:0:0:
>> >   drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
>> >   ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
>> >   declared with attribute error: FIELD_PREP: mask is not constant
>> >     _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>> > 
>> > and other build errors due to shift overflowing values.
>> > 
>> > See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
>> > details as to why it triggers with older gccs only.
>> > 
>> 
>> Acked-by: Randy Dunlap <rdunlap@infradead.org>
>> Tested-by: Randy Dunlap <rdunlap@infradead.org>
>> 
>> Is this merged anywhere?
>
> It's state is "new" in their patchwork:
>
> https://patchwork.freedesktop.org/patch/480756/

Basically we run all patches through CI before merging, and because only
one patch was sent to intel-gfx, the CI just sat waiting for the rest of
the series to arrive...

Anyway, didn't really like the changes in i915_reg.h, sent my version of
that and the rest separately [1].

> so I guess not yet.
>
>> It could/should at least be in linux-next so that other people
>> don't waste time on it.
>
> -ETOOMANYPATCHES I guess. :-\

Yeah, sorry about that.


BR,
Jani.

[1] https://patchwork.freedesktop.org/series/104122/


-- 
Jani Nikula, Intel Open Source Graphics Center

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

* Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
  2022-04-25 18:46   ` Randy Dunlap
@ 2022-05-19 13:05     ` Daniel Vetter
  2022-06-16 16:06       ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2022-05-19 13:05 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: David Airlie, LKML, dri-devel, Borislav Petkov, Alex Deucher

On Mon, Apr 25, 2022 at 11:46:53AM -0700, Randy Dunlap wrote:
> 
> 
> On 4/5/22 08:15, Borislav Petkov wrote:
> > From: Borislav Petkov <bp@suse.de>
> > 
> > Fix:
> > 
> >   drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
> >   drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
> >     case R128_PM4_64BM_64VCBM_64INDBM:
> >     ^~~~
> >   drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
> >     case R128_PM4_64PIO_64VCPIO_64INDPIO:
> >     ^~~~
> > 
> > See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
> > details as to why it triggers with older gccs only.
> > 
> > Signed-off-by: Borislav Petkov <bp@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: dri-devel@lists.freedesktop.org
> 
> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Pushed to drm-misc-next, thanks for patch&review.
-Daniel

> 
> Thanks.
> 
> > ---
> >  drivers/gpu/drm/r128/r128_drv.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
> > index 2e1bc01aa5c9..970e192b0d51 100644
> > --- a/drivers/gpu/drm/r128/r128_drv.h
> > +++ b/drivers/gpu/drm/r128/r128_drv.h
> > @@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
> >  #	define R128_PM4_64PIO_128INDBM		(5  << 28)
> >  #	define R128_PM4_64BM_128INDBM		(6  << 28)
> >  #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
> > -#	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
> > -#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
> > +#	define R128_PM4_64BM_64VCBM_64INDBM	(8U  << 28)
> > +#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15U << 28)
> >  #	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
> >  
> >  #define R128_PM4_BUFFER_WM_CNTL		0x0708
> 
> -- 
> ~Randy

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
  2022-05-19 13:05     ` Daniel Vetter
@ 2022-06-16 16:06       ` Randy Dunlap
  2022-06-24 20:13         ` Daniel Vetter
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2022-06-16 16:06 UTC (permalink / raw)
  To: Borislav Petkov, LKML, David Airlie, Alex Deucher, dri-devel



On 5/19/22 06:05, Daniel Vetter wrote:
> On Mon, Apr 25, 2022 at 11:46:53AM -0700, Randy Dunlap wrote:
>>
>>
>> On 4/5/22 08:15, Borislav Petkov wrote:
>>> From: Borislav Petkov <bp@suse.de>
>>>
>>> Fix:
>>>
>>>   drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
>>>   drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
>>>     case R128_PM4_64BM_64VCBM_64INDBM:
>>>     ^~~~
>>>   drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
>>>     case R128_PM4_64PIO_64VCPIO_64INDPIO:
>>>     ^~~~
>>>
>>> See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
>>> details as to why it triggers with older gccs only.
>>>
>>> Signed-off-by: Borislav Petkov <bp@suse.de>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>> Cc: Alex Deucher <alexander.deucher@amd.com>
>>> Cc: dri-devel@lists.freedesktop.org
>>
>> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
> 
> Pushed to drm-misc-next, thanks for patch&review.
> -Daniel
> 

Hi,

Will this be merged to mainline any time soonish?

thanks.

>>
>> Thanks.
>>
>>> ---
>>>  drivers/gpu/drm/r128/r128_drv.h | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
>>> index 2e1bc01aa5c9..970e192b0d51 100644
>>> --- a/drivers/gpu/drm/r128/r128_drv.h
>>> +++ b/drivers/gpu/drm/r128/r128_drv.h
>>> @@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
>>>  #	define R128_PM4_64PIO_128INDBM		(5  << 28)
>>>  #	define R128_PM4_64BM_128INDBM		(6  << 28)
>>>  #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
>>> -#	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
>>> -#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
>>> +#	define R128_PM4_64BM_64VCBM_64INDBM	(8U  << 28)
>>> +#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15U << 28)
>>>  #	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
>>>  
>>>  #define R128_PM4_BUFFER_WM_CNTL		0x0708
>>
>> -- 
>> ~Randy
> 

-- 
~Randy

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

* Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
  2022-06-16 16:06       ` Randy Dunlap
@ 2022-06-24 20:13         ` Daniel Vetter
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2022-06-24 20:13 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: David Airlie, Alex Deucher, Borislav Petkov, LKML, dri-devel

On Thu, Jun 16, 2022 at 09:06:45AM -0700, Randy Dunlap wrote:
> 
> 
> On 5/19/22 06:05, Daniel Vetter wrote:
> > On Mon, Apr 25, 2022 at 11:46:53AM -0700, Randy Dunlap wrote:
> >>
> >>
> >> On 4/5/22 08:15, Borislav Petkov wrote:
> >>> From: Borislav Petkov <bp@suse.de>
> >>>
> >>> Fix:
> >>>
> >>>   drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
> >>>   drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
> >>>     case R128_PM4_64BM_64VCBM_64INDBM:
> >>>     ^~~~
> >>>   drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
> >>>     case R128_PM4_64PIO_64VCPIO_64INDPIO:
> >>>     ^~~~
> >>>
> >>> See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
> >>> details as to why it triggers with older gccs only.
> >>>
> >>> Signed-off-by: Borislav Petkov <bp@suse.de>
> >>> Cc: David Airlie <airlied@linux.ie>
> >>> Cc: Daniel Vetter <daniel@ffwll.ch>
> >>> Cc: Alex Deucher <alexander.deucher@amd.com>
> >>> Cc: dri-devel@lists.freedesktop.org
> >>
> >> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
> > 
> > Pushed to drm-misc-next, thanks for patch&review.
> > -Daniel
> > 
> 
> Hi,
> 
> Will this be merged to mainline any time soonish?

It missed the merge window by a hair, so it's in linux-next and will get
into the next one.
-Daniel

> 
> thanks.
> 
> >>
> >> Thanks.
> >>
> >>> ---
> >>>  drivers/gpu/drm/r128/r128_drv.h | 4 ++--
> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
> >>> index 2e1bc01aa5c9..970e192b0d51 100644
> >>> --- a/drivers/gpu/drm/r128/r128_drv.h
> >>> +++ b/drivers/gpu/drm/r128/r128_drv.h
> >>> @@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
> >>>  #	define R128_PM4_64PIO_128INDBM		(5  << 28)
> >>>  #	define R128_PM4_64BM_128INDBM		(6  << 28)
> >>>  #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
> >>> -#	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
> >>> -#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
> >>> +#	define R128_PM4_64BM_64VCBM_64INDBM	(8U  << 28)
> >>> +#	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15U << 28)
> >>>  #	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
> >>>  
> >>>  #define R128_PM4_BUFFER_WM_CNTL		0x0708
> >>
> >> -- 
> >> ~Randy
> > 
> 
> -- 
> ~Randy

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2022-06-24 20:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220405151517.29753-1-bp@alien8.de>
2022-04-05 15:15 ` [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
2022-04-25 18:46   ` Randy Dunlap
2022-05-19 13:05     ` Daniel Vetter
2022-06-16 16:06       ` Randy Dunlap
2022-06-24 20:13         ` Daniel Vetter
2022-04-05 15:15 ` [PATCH 11/11] drm/i915: " Borislav Petkov
2022-05-17 23:05   ` Randy Dunlap
2022-05-18  7:44     ` Borislav Petkov
2022-05-18 11:39       ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox