diff mbox

drm/i915/guc: Consolidate firmware major-minor to one place

Message ID 1467290814-12285-1-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin June 30, 2016, 12:46 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Currently to change the firmware one has to update the exported
module firmware string and the major-minor versions used for
verification after load. Consolidate that to a single place
defining correct major and minor versions per platform.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Dave Gordon <david.s.gordon@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

Comments

Jani Nikula June 30, 2016, 1:01 p.m. UTC | #1
On Thu, 30 Jun 2016, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Currently to change the firmware one has to update the exported
> module firmware string and the major-minor versions used for
> verification after load. Consolidate that to a single place
> defining correct major and minor versions per platform.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Dave Gordon <david.s.gordon@intel.com>

I guess this would be nice on top of the patch that enables guc loading
on kbl?

Jani.

> ---
>  drivers/gpu/drm/i915/intel_guc_loader.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 4f6311a91a7e..9b08afafe802 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -59,10 +59,19 @@
>   *
>   */
>  
> -#define I915_SKL_GUC_UCODE "i915/skl_guc_ver6_1.bin"
> +#define SKL_FW_MAJOR 6
> +#define SKL_FW_MINOR 1
> +
> +#define BXT_FW_MAJOR 8
> +#define BXT_FW_MINOR 7
> +
> +#define GUC_FW_PATH(platform, major, minor) \
> +	"i915/" __stringify(platform) "_guc_ver" __stringify(major) "_" __stringify(minor) ".bin"
> +
> +#define I915_SKL_GUC_UCODE GUC_FW_PATH(skl, SKL_FW_MAJOR, SKL_FW_MINOR)
>  MODULE_FIRMWARE(I915_SKL_GUC_UCODE);
>  
> -#define I915_BXT_GUC_UCODE "i915/bxt_guc_ver8_7.bin"
> +#define I915_BXT_GUC_UCODE GUC_FW_PATH(bxt, BXT_FW_MAJOR, BXT_FW_MINOR)
>  MODULE_FIRMWARE(I915_BXT_GUC_UCODE);
>  
>  /* User-friendly representation of an enum */
> @@ -692,12 +701,12 @@ void intel_guc_init(struct drm_device *dev)
>  		fw_path = NULL;
>  	} else if (IS_SKYLAKE(dev)) {
>  		fw_path = I915_SKL_GUC_UCODE;
> -		guc_fw->guc_fw_major_wanted = 6;
> -		guc_fw->guc_fw_minor_wanted = 1;
> +		guc_fw->guc_fw_major_wanted = SKL_FW_MAJOR;
> +		guc_fw->guc_fw_minor_wanted = SKL_FW_MINOR;
>  	} else if (IS_BROXTON(dev)) {
>  		fw_path = I915_BXT_GUC_UCODE;
> -		guc_fw->guc_fw_major_wanted = 8;
> -		guc_fw->guc_fw_minor_wanted = 7;
> +		guc_fw->guc_fw_major_wanted = BXT_FW_MAJOR;
> +		guc_fw->guc_fw_minor_wanted = BXT_FW_MINOR;
>  	} else {
>  		fw_path = "";	/* unknown device */
>  	}
Dave Gordon July 1, 2016, 5:57 p.m. UTC | #2
On 30/06/16 13:46, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Currently to change the firmware one has to update the exported
> module firmware string and the major-minor versions used for
> verification after load. Consolidate that to a single place
> defining correct major and minor versions per platform.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Dave Gordon <david.s.gordon@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_guc_loader.c | 21 +++++++++++++++------
>   1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 4f6311a91a7e..9b08afafe802 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -59,10 +59,19 @@
>    *
>    */
>
> -#define I915_SKL_GUC_UCODE "i915/skl_guc_ver6_1.bin"
> +#define SKL_FW_MAJOR 6
> +#define SKL_FW_MINOR 1
> +
> +#define BXT_FW_MAJOR 8
> +#define BXT_FW_MINOR 7
> +
> +#define GUC_FW_PATH(platform, major, minor) \
> +	"i915/" __stringify(platform) "_guc_ver" __stringify(major) "_" __stringify(minor) ".bin"
> +
> +#define I915_SKL_GUC_UCODE GUC_FW_PATH(skl, SKL_FW_MAJOR, SKL_FW_MINOR)
>   MODULE_FIRMWARE(I915_SKL_GUC_UCODE);
>
> -#define I915_BXT_GUC_UCODE "i915/bxt_guc_ver8_7.bin"
> +#define I915_BXT_GUC_UCODE GUC_FW_PATH(bxt, BXT_FW_MAJOR, BXT_FW_MINOR)
>   MODULE_FIRMWARE(I915_BXT_GUC_UCODE);
>
>   /* User-friendly representation of an enum */
> @@ -692,12 +701,12 @@ void intel_guc_init(struct drm_device *dev)
>   		fw_path = NULL;
>   	} else if (IS_SKYLAKE(dev)) {
>   		fw_path = I915_SKL_GUC_UCODE;
> -		guc_fw->guc_fw_major_wanted = 6;
> -		guc_fw->guc_fw_minor_wanted = 1;
> +		guc_fw->guc_fw_major_wanted = SKL_FW_MAJOR;
> +		guc_fw->guc_fw_minor_wanted = SKL_FW_MINOR;
>   	} else if (IS_BROXTON(dev)) {
>   		fw_path = I915_BXT_GUC_UCODE;
> -		guc_fw->guc_fw_major_wanted = 8;
> -		guc_fw->guc_fw_minor_wanted = 7;
> +		guc_fw->guc_fw_major_wanted = BXT_FW_MAJOR;
> +		guc_fw->guc_fw_minor_wanted = BXT_FW_MINOR;
>   	} else {
>   		fw_path = "";	/* unknown device */
>   	}

Looks fine.
Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 4f6311a91a7e..9b08afafe802 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -59,10 +59,19 @@ 
  *
  */
 
-#define I915_SKL_GUC_UCODE "i915/skl_guc_ver6_1.bin"
+#define SKL_FW_MAJOR 6
+#define SKL_FW_MINOR 1
+
+#define BXT_FW_MAJOR 8
+#define BXT_FW_MINOR 7
+
+#define GUC_FW_PATH(platform, major, minor) \
+	"i915/" __stringify(platform) "_guc_ver" __stringify(major) "_" __stringify(minor) ".bin"
+
+#define I915_SKL_GUC_UCODE GUC_FW_PATH(skl, SKL_FW_MAJOR, SKL_FW_MINOR)
 MODULE_FIRMWARE(I915_SKL_GUC_UCODE);
 
-#define I915_BXT_GUC_UCODE "i915/bxt_guc_ver8_7.bin"
+#define I915_BXT_GUC_UCODE GUC_FW_PATH(bxt, BXT_FW_MAJOR, BXT_FW_MINOR)
 MODULE_FIRMWARE(I915_BXT_GUC_UCODE);
 
 /* User-friendly representation of an enum */
@@ -692,12 +701,12 @@  void intel_guc_init(struct drm_device *dev)
 		fw_path = NULL;
 	} else if (IS_SKYLAKE(dev)) {
 		fw_path = I915_SKL_GUC_UCODE;
-		guc_fw->guc_fw_major_wanted = 6;
-		guc_fw->guc_fw_minor_wanted = 1;
+		guc_fw->guc_fw_major_wanted = SKL_FW_MAJOR;
+		guc_fw->guc_fw_minor_wanted = SKL_FW_MINOR;
 	} else if (IS_BROXTON(dev)) {
 		fw_path = I915_BXT_GUC_UCODE;
-		guc_fw->guc_fw_major_wanted = 8;
-		guc_fw->guc_fw_minor_wanted = 7;
+		guc_fw->guc_fw_major_wanted = BXT_FW_MAJOR;
+		guc_fw->guc_fw_minor_wanted = BXT_FW_MINOR;
 	} else {
 		fw_path = "";	/* unknown device */
 	}