Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
	linux-media@vger.kernel.org, quic_vgarodia@quicinc.com,
	agross@kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, mchehab@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Viswanath Boma <quic_vboma@quicinc.com>
Subject: Re: [PATCH v2 1/3] venus: add firmware version based check
Date: Sun, 9 Apr 2023 08:18:45 +0300	[thread overview]
Message-ID: <6c3002ad-ff78-8818-0e68-a151d33b0fca@gmail.com> (raw)
In-Reply-To: <1680848758-3947-2-git-send-email-quic_dikshita@quicinc.com>

Hi Dikshita,

Thanks for the patch.

On 7.04.23 г. 9:25 ч., Dikshita Agarwal wrote:
> Add firmware version based checks to enable/disable
> features for different SOCs.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
> Tested-by: Nathan Hebert <nhebert@chromium.org>
> ---
>   drivers/media/platform/qcom/venus/core.h     | 20 ++++++++++++++++++++
>   drivers/media/platform/qcom/venus/hfi_msgs.c | 11 +++++++++--
>   2 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index 32551c2..9d1e4b2 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -202,6 +202,11 @@ struct venus_core {
>   	unsigned int core0_usage_count;
>   	unsigned int core1_usage_count;
>   	struct dentry *root;
> +	struct venus_img_version {
> +		u32 major;
> +		u32 minor;
> +		u32 rev;
> +	} venus_ver;
>   };
>   
>   struct vdec_controls {
> @@ -500,4 +505,19 @@ venus_caps_by_codec(struct venus_core *core, u32 codec, u32 domain)
>   	return NULL;
>   }
>   
> +static inline int
> +is_fw_rev_or_newer(struct venus_core *core, u32 vmajor, u32 vminor, u32 vrev)
> +{
> +	return ((core)->venus_ver.major == vmajor &&
> +		(core)->venus_ver.minor == vminor &&
> +		(core)->venus_ver.rev >= vrev);
> +}
> +
> +static inline int
> +is_fw_rev_or_older(struct venus_core *core, u32 vmajor, u32 vminor, u32 vrev)
> +{
> +	return ((core)->venus_ver.major == vmajor &&
> +		(core)->venus_ver.minor == vminor &&
> +		(core)->venus_ver.rev <= vrev);
> +}

IMO those two should return bool

>   #endif
> diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c
> index df96db3..07ac0fc 100644
> --- a/drivers/media/platform/qcom/venus/hfi_msgs.c
> +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
> @@ -248,9 +248,10 @@ static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst,
>   }
>   
>   static void
> -sys_get_prop_image_version(struct device *dev,
> +sys_get_prop_image_version(struct venus_core *core,
>   			   struct hfi_msg_sys_property_info_pkt *pkt)
>   {
> +	struct device *dev = core->dev;
>   	u8 *smem_tbl_ptr;
>   	u8 *img_ver;
>   	int req_bytes;
> @@ -263,6 +264,12 @@ sys_get_prop_image_version(struct device *dev,
>   		return;
>   
>   	img_ver = pkt->data;
> +	if (IS_V4(core))
> +		sscanf(img_ver, "14:VIDEO.VE.%u.%u-%u-PROD",
> +		       &core->venus_ver.major, &core->venus_ver.minor, &core->venus_ver.rev);
> +	else if (IS_V6(core))
> +		sscanf(img_ver, "14:VIDEO.VPU.%u.%u-%u-PROD",
> +		       &core->venus_ver.major, &core->venus_ver.minor, &core->venus_ver.rev);
>   

what about if IS_V1?

>   	dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver);

this will crash for v1.

>   
> @@ -286,7 +293,7 @@ static void hfi_sys_property_info(struct venus_core *core,
>   
>   	switch (pkt->property) {
>   	case HFI_PROPERTY_SYS_IMAGE_VERSION:
> -		sys_get_prop_image_version(dev, pkt);
> +		sys_get_prop_image_version(core, pkt);
>   		break;
>   	default:
>   		dev_dbg(dev, VDBGL "unknown property data\n");

-- 
regards,
Stan

  parent reply	other threads:[~2023-04-09  5:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  6:25 [PATCH v2 0/3] fix decoder issues with firmware version check Dikshita Agarwal
2023-04-07  6:25 ` [PATCH v2 1/3] venus: add firmware version based check Dikshita Agarwal
2023-04-08  7:15   ` Konrad Dybcio
2023-04-18  9:47     ` Dikshita Agarwal
2023-04-09  5:18   ` Stanimir Varbanov [this message]
2023-04-11 10:59     ` Konrad Dybcio
2023-04-13 23:01       ` Konrad Dybcio
2023-04-13 23:08         ` Konrad Dybcio
2023-04-18  9:51     ` Dikshita Agarwal
2023-04-07  6:25 ` [PATCH v2 2/3] venus: enable sufficient sequence change support for vp9 Dikshita Agarwal
2023-04-09 17:10   ` Dmitry Baryshkov
2023-04-07  6:25 ` [PATCH v2 3/3] venus: fix EOS handling in decoder stop command Dikshita Agarwal
2023-04-09 17:10   ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c3002ad-ff78-8818-0e68-a151d33b0fca@gmail.com \
    --to=stanimir.k.varbanov@gmail.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vboma@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox