diff mbox series

[2/2] drm/i915/soc: stop using IS_GEN9_LP() and IS_GEN9_BC()

Message ID 20240918145042.1447857-2-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915: remove IS_LP() | expand

Commit Message

Jani Nikula Sept. 18, 2024, 2:50 p.m. UTC
Replace IS_GEN9_LP() and IS_GEN9_BC() with direct platform checks. This
lets us remove their compat counterparts, as neither soc/ nor /display
now no longer needs them.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/soc/intel_dram.c             | 4 ++--
 drivers/gpu/drm/i915/soc/intel_pch.c              | 9 ++++++---
 drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 3 ---
 3 files changed, 8 insertions(+), 8 deletions(-)

Comments

Ville Syrjala Sept. 18, 2024, 5:56 p.m. UTC | #1
On Wed, Sep 18, 2024 at 05:50:42PM +0300, Jani Nikula wrote:
> Replace IS_GEN9_LP() and IS_GEN9_BC() with direct platform checks. This
> lets us remove their compat counterparts, as neither soc/ nor /display
> now no longer needs them.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/soc/intel_dram.c             | 4 ++--
>  drivers/gpu/drm/i915/soc/intel_pch.c              | 9 ++++++---
>  drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.c b/drivers/gpu/drm/i915/soc/intel_dram.c
> index 4aba47bccc63..9e310f4099f4 100644
> --- a/drivers/gpu/drm/i915/soc/intel_dram.c
> +++ b/drivers/gpu/drm/i915/soc/intel_dram.c
> @@ -714,7 +714,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  	 * Assume level 0 watermark latency adjustment is needed until proven
>  	 * otherwise, this w/a is not needed by bxt/glk.
>  	 */
> -	dram_info->wm_lv_0_adjust_needed = !IS_GEN9_LP(i915);
> +	dram_info->wm_lv_0_adjust_needed = !IS_BROXTON(i915) && !IS_GEMINILAKE(i915);

This reminds me that this is a mess. Need to dig up
whatever branch I had to make it less so...

>  
>  	if (DISPLAY_VER(i915) >= 14)
>  		ret = xelpdp_get_dram_info(i915);
> @@ -722,7 +722,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
>  		ret = gen12_get_dram_info(i915);
>  	else if (GRAPHICS_VER(i915) >= 11)
>  		ret = gen11_get_dram_info(i915);
> -	else if (IS_GEN9_LP(i915))
> +	else if (IS_BROXTON(i915) || IS_GEMINILAKE(i915))
>  		ret = bxt_get_dram_info(i915);
>  	else
>  		ret = skl_get_dram_info(i915);
> diff --git a/drivers/gpu/drm/i915/soc/intel_pch.c b/drivers/gpu/drm/i915/soc/intel_pch.c
> index 542eea50093c..f7e3745bb1dc 100644
> --- a/drivers/gpu/drm/i915/soc/intel_pch.c
> +++ b/drivers/gpu/drm/i915/soc/intel_pch.c
> @@ -122,9 +122,12 @@ intel_pch_type(const struct drm_i915_private *dev_priv, unsigned short id)
>  	case INTEL_PCH_TGP_DEVICE_ID_TYPE:
>  	case INTEL_PCH_TGP2_DEVICE_ID_TYPE:
>  		drm_dbg_kms(&dev_priv->drm, "Found Tiger Lake LP PCH\n");
> -		drm_WARN_ON(&dev_priv->drm, !IS_TIGERLAKE(dev_priv) &&
> -			    !IS_ROCKETLAKE(dev_priv) &&
> -			    !IS_GEN9_BC(dev_priv));
> +		drm_WARN_ON(&dev_priv->drm, !(IS_TIGERLAKE(dev_priv) ||
> +					      IS_ROCKETLAKE(dev_priv) ||
> +					      IS_SKYLAKE(dev_priv) ||
> +					      IS_KABYLAKE(dev_priv) ||
> +					      IS_COFFEELAKE(dev_priv) ||
> +					      IS_COMETLAKE(dev_priv)));

The !A&&!B form seems more popular in these, so I'd suggest
using that. JSP looks to be the only one that had to do it
differently for whatever reason...

Either way
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  		return PCH_TGP;
>  	case INTEL_PCH_JSP_DEVICE_ID_TYPE:
>  		drm_dbg_kms(&dev_priv->drm, "Found Jasper Lake PCH\n");
> diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> index c43673bcecde..684e7a25e3ef 100644
> --- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> +++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> @@ -75,9 +75,6 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
>  
>  #define IS_MOBILE(xe) (xe && 0)
>  
> -#define IS_GEN9_LP(xe) ((xe) && 0)
> -#define IS_GEN9_BC(xe) ((xe) && 0)
> -
>  #define IS_TIGERLAKE_UY(xe) (xe && 0)
>  #define IS_COMETLAKE_ULX(xe) (xe && 0)
>  #define IS_COFFEELAKE_ULX(xe) (xe && 0)
> -- 
> 2.39.2
Jani Nikula Sept. 23, 2024, 9:06 a.m. UTC | #2
On Wed, 18 Sep 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Wed, Sep 18, 2024 at 05:50:42PM +0300, Jani Nikula wrote:
>> diff --git a/drivers/gpu/drm/i915/soc/intel_pch.c b/drivers/gpu/drm/i915/soc/intel_pch.c
>> index 542eea50093c..f7e3745bb1dc 100644
>> --- a/drivers/gpu/drm/i915/soc/intel_pch.c
>> +++ b/drivers/gpu/drm/i915/soc/intel_pch.c
>> @@ -122,9 +122,12 @@ intel_pch_type(const struct drm_i915_private *dev_priv, unsigned short id)
>>  	case INTEL_PCH_TGP_DEVICE_ID_TYPE:
>>  	case INTEL_PCH_TGP2_DEVICE_ID_TYPE:
>>  		drm_dbg_kms(&dev_priv->drm, "Found Tiger Lake LP PCH\n");
>> -		drm_WARN_ON(&dev_priv->drm, !IS_TIGERLAKE(dev_priv) &&
>> -			    !IS_ROCKETLAKE(dev_priv) &&
>> -			    !IS_GEN9_BC(dev_priv));
>> +		drm_WARN_ON(&dev_priv->drm, !(IS_TIGERLAKE(dev_priv) ||
>> +					      IS_ROCKETLAKE(dev_priv) ||
>> +					      IS_SKYLAKE(dev_priv) ||
>> +					      IS_KABYLAKE(dev_priv) ||
>> +					      IS_COFFEELAKE(dev_priv) ||
>> +					      IS_COMETLAKE(dev_priv)));
>
> The !A&&!B form seems more popular in these, so I'd suggest
> using that. JSP looks to be the only one that had to do it
> differently for whatever reason...
>
> Either way
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks, I'll need to rebase the series anyway, I'll switch to the more
common style.

BR,
Jani.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/soc/intel_dram.c b/drivers/gpu/drm/i915/soc/intel_dram.c
index 4aba47bccc63..9e310f4099f4 100644
--- a/drivers/gpu/drm/i915/soc/intel_dram.c
+++ b/drivers/gpu/drm/i915/soc/intel_dram.c
@@ -714,7 +714,7 @@  void intel_dram_detect(struct drm_i915_private *i915)
 	 * Assume level 0 watermark latency adjustment is needed until proven
 	 * otherwise, this w/a is not needed by bxt/glk.
 	 */
-	dram_info->wm_lv_0_adjust_needed = !IS_GEN9_LP(i915);
+	dram_info->wm_lv_0_adjust_needed = !IS_BROXTON(i915) && !IS_GEMINILAKE(i915);
 
 	if (DISPLAY_VER(i915) >= 14)
 		ret = xelpdp_get_dram_info(i915);
@@ -722,7 +722,7 @@  void intel_dram_detect(struct drm_i915_private *i915)
 		ret = gen12_get_dram_info(i915);
 	else if (GRAPHICS_VER(i915) >= 11)
 		ret = gen11_get_dram_info(i915);
-	else if (IS_GEN9_LP(i915))
+	else if (IS_BROXTON(i915) || IS_GEMINILAKE(i915))
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
diff --git a/drivers/gpu/drm/i915/soc/intel_pch.c b/drivers/gpu/drm/i915/soc/intel_pch.c
index 542eea50093c..f7e3745bb1dc 100644
--- a/drivers/gpu/drm/i915/soc/intel_pch.c
+++ b/drivers/gpu/drm/i915/soc/intel_pch.c
@@ -122,9 +122,12 @@  intel_pch_type(const struct drm_i915_private *dev_priv, unsigned short id)
 	case INTEL_PCH_TGP_DEVICE_ID_TYPE:
 	case INTEL_PCH_TGP2_DEVICE_ID_TYPE:
 		drm_dbg_kms(&dev_priv->drm, "Found Tiger Lake LP PCH\n");
-		drm_WARN_ON(&dev_priv->drm, !IS_TIGERLAKE(dev_priv) &&
-			    !IS_ROCKETLAKE(dev_priv) &&
-			    !IS_GEN9_BC(dev_priv));
+		drm_WARN_ON(&dev_priv->drm, !(IS_TIGERLAKE(dev_priv) ||
+					      IS_ROCKETLAKE(dev_priv) ||
+					      IS_SKYLAKE(dev_priv) ||
+					      IS_KABYLAKE(dev_priv) ||
+					      IS_COFFEELAKE(dev_priv) ||
+					      IS_COMETLAKE(dev_priv)));
 		return PCH_TGP;
 	case INTEL_PCH_JSP_DEVICE_ID_TYPE:
 		drm_dbg_kms(&dev_priv->drm, "Found Jasper Lake PCH\n");
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
index c43673bcecde..684e7a25e3ef 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
@@ -75,9 +75,6 @@  static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
 
 #define IS_MOBILE(xe) (xe && 0)
 
-#define IS_GEN9_LP(xe) ((xe) && 0)
-#define IS_GEN9_BC(xe) ((xe) && 0)
-
 #define IS_TIGERLAKE_UY(xe) (xe && 0)
 #define IS_COMETLAKE_ULX(xe) (xe && 0)
 #define IS_COFFEELAKE_ULX(xe) (xe && 0)