diff mbox

[1/5] drm/i915: Store and print dmc firmware version

Message ID 1442589429-27813-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Sept. 18, 2015, 3:17 p.m. UTC
Parse csr/dmc firmware version and augment debug message
by printing it.

Cc: Animesh Manna <animesh.manna@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  | 2 ++
 drivers/gpu/drm/i915/intel_csr.c | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Manna, Animesh Oct. 8, 2015, 9:56 a.m. UTC | #1
On 9/18/2015 8:47 PM, Mika Kuoppala wrote:
> Parse csr/dmc firmware version and augment debug message
> by printing it.
>
> Cc: Animesh Manna <animesh.manna@intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.h  | 2 ++
>   drivers/gpu/drm/i915/intel_csr.c | 7 ++++++-
>   2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3bf8a9b..17e8b25 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -755,6 +755,8 @@ struct intel_csr {
>   	const char *fw_path;
>   	uint32_t *dmc_payload;
>   	uint32_t dmc_fw_size;
> +	uint16_t dmc_ver_major;
> +	uint16_t dmc_ver_minor;
>   	uint32_t mmio_count;
>   	uint32_t mmioaddr[8];
>   	uint32_t mmiodata[8];
> diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
> index b69264d..58edc3f 100644
> --- a/drivers/gpu/drm/i915/intel_csr.c
> +++ b/drivers/gpu/drm/i915/intel_csr.c
> @@ -377,11 +377,16 @@ static void finish_csr_load(const struct firmware *fw, void *context)
>   	dmc_payload = csr->dmc_payload;
>   	memcpy(dmc_payload, &fw->data[readcount], nbytes);
>   
> +	csr->dmc_ver_major = dmc_header->header_ver;
> +	csr->dmc_ver_minor = ((dmc_header->fw_version & 0xffff0000) >> 16) * 10
> +		+ (dmc_header->fw_version & 0x0000ffff);
> +

I am not able to locate the the way major and minor version is derived, is it present in bspec?

-Animesh

>   	/* load csr program during system boot, as needed for DC states */
>   	intel_csr_load_program(dev);
>   	fw_loaded = true;
>   
> -	DRM_DEBUG_KMS("Finished loading %s\n", dev_priv->csr.fw_path);
> +	DRM_DEBUG_KMS("Finished loading %s v%u.%u\n", dev_priv->csr.fw_path,
> +		      csr->dmc_ver_major, csr->dmc_ver_minor);
>   out:
>   	if (fw_loaded)
>   		intel_runtime_pm_put(dev_priv);
Lespiau, Damien Oct. 8, 2015, 11:03 a.m. UTC | #2
On Fri, Sep 18, 2015 at 06:17:05PM +0300, Mika Kuoppala wrote:
> Parse csr/dmc firmware version and augment debug message
> by printing it.
> 
> Cc: Animesh Manna <animesh.manna@intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

FWIW I did something similar in the past, but that contribution was
denied. I also had the DC states entry counts, which sounds like
something super useful to have:

  http://lists.freedesktop.org/archives/intel-gfx/2015-June/thread.html

The DMC firmware version decoding was different in my patch and I'm sure
it worked then. Maye the header has changed :(

Feel free to use any part of that series with your authorship.
Lespiau, Damien Oct. 8, 2015, 3:04 p.m. UTC | #3
On Thu, Oct 08, 2015 at 12:03:30PM +0100, Damien Lespiau wrote:
> The DMC firmware version decoding was different in my patch and I'm sure
> it worked then. Maye the header has changed :(

By the way, if this is indeed the case, could you fix
intel_firmware_decode as well?

  http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tools/intel_firmware_decode.c

Thanks,
Mika Kuoppala Oct. 21, 2015, 1:46 p.m. UTC | #4
Damien Lespiau <damien.lespiau@intel.com> writes:

> On Thu, Oct 08, 2015 at 12:03:30PM +0100, Damien Lespiau wrote:
>> The DMC firmware version decoding was different in my patch and I'm sure
>> it worked then. Maye the header has changed :(
>
> By the way, if this is indeed the case, could you fix
> intel_firmware_decode as well?
>
>   http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tools/intel_firmware_decode.c
>

Well this seems to be somewhat convoluted. The CSS header has a version
and then each binary package has their own. The fw version in binary
package seems to code only the minor part like in my patches.

I went through various firmware images and these seems to be in sync
currently so that version in CSS follows the version in dmc header,
albeit with different encoding.

There is not much info on bspec but I guess we should just
use the version provided in CSS header.

-Mika

> Thanks,
>
> -- 
> Damien
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3bf8a9b..17e8b25 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -755,6 +755,8 @@  struct intel_csr {
 	const char *fw_path;
 	uint32_t *dmc_payload;
 	uint32_t dmc_fw_size;
+	uint16_t dmc_ver_major;
+	uint16_t dmc_ver_minor;
 	uint32_t mmio_count;
 	uint32_t mmioaddr[8];
 	uint32_t mmiodata[8];
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
index b69264d..58edc3f 100644
--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -377,11 +377,16 @@  static void finish_csr_load(const struct firmware *fw, void *context)
 	dmc_payload = csr->dmc_payload;
 	memcpy(dmc_payload, &fw->data[readcount], nbytes);
 
+	csr->dmc_ver_major = dmc_header->header_ver;
+	csr->dmc_ver_minor = ((dmc_header->fw_version & 0xffff0000) >> 16) * 10
+		+ (dmc_header->fw_version & 0x0000ffff);
+
 	/* load csr program during system boot, as needed for DC states */
 	intel_csr_load_program(dev);
 	fw_loaded = true;
 
-	DRM_DEBUG_KMS("Finished loading %s\n", dev_priv->csr.fw_path);
+	DRM_DEBUG_KMS("Finished loading %s v%u.%u\n", dev_priv->csr.fw_path,
+		      csr->dmc_ver_major, csr->dmc_ver_minor);
 out:
 	if (fw_loaded)
 		intel_runtime_pm_put(dev_priv);