Message ID | 1680848758-3947-2-git-send-email-quic_dikshita@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp97316vqo; Thu, 6 Apr 2023 23:59:06 -0700 (PDT) X-Google-Smtp-Source: AKy350ZzYkMfBxbr/Lez3hdSXziR9Bfp0oQJCVSPgl6mBfOB1QBqrRvAvQGVsSJNlo9fuEz0mp1X X-Received: by 2002:aa7:9d0e:0:b0:628:daf:2c84 with SMTP id k14-20020aa79d0e000000b006280daf2c84mr1480113pfp.33.1680850746212; Thu, 06 Apr 2023 23:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680850746; cv=none; d=google.com; s=arc-20160816; b=QKlSpdUIoWR3A30+UeVGptk7OZZB/0Tb3r3GL1yZl8BoyKOJiJLbYv0wbBjdLtcHDY 8xWVQofz/8IvvlPblrbmhBnG2/l61Bx+KZNqjSYuHtQp2i6FF0U9FeI7rhEnrDFk4BkL CtAtnbvsPSfnXxT35Yb3NPzSKLw8sH4CYIEXz27+ec1pFYN2D+gshyZ2qUbG06KNv+o3 vcdYa327F55u3p5UfKOCwn+gygaFWjJaC3nstvKfebiaJLhQXx25Z5isOe4lkOYQwDXI XUY7uMvlImXJQOWGE5AuxNH1G+Mq93RPiIAsrc8xpAJGEjYLEjkkTwfEHYVU15fMP0Mr p1Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=dS5VeuYXriPxVH2Fth6dJvTRBBS6ORIkrXIfqrTCxKQ=; b=Gfmnqh8GjJ5zB2tORX8vg9GLiXcJESoniN0RDN3F5HwmHozZadQLg01PTWI23YC3jN dSg+sgZ6dEH1F2i/nNgEFKWWUvQWFKabO33YMYPqJtZRBti7l0An7o1c6UhEAYkYWvhH g4QUpUzMziVadwCzFIb1b2OPMZaZnCjMynXObcKJpRXt3iffm7x0KO2seQsMmPd3xr8o 5uLgUSDBlUjuBTmTfSnFHj2UgWFYVlVlNdkcsFJcqaVdX7/aIWthHjvCqR5gSCg/KB1d Xj+IwgpI0YpdCHdoAGNim2o1N0b46RTNkP1t2na3x/431UXAeiHM0eOwtccOdNUpg4tQ ViFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PQmsMnN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h37-20020a635765000000b005030925d31asi2927392pgm.203.2023.04.06.23.58.53; Thu, 06 Apr 2023 23:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PQmsMnN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239281AbjDGG0W (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Fri, 7 Apr 2023 02:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239104AbjDGG0U (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Apr 2023 02:26:20 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1085EA5FD; Thu, 6 Apr 2023 23:26:15 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33761FvX010936; Fri, 7 Apr 2023 06:26:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=dS5VeuYXriPxVH2Fth6dJvTRBBS6ORIkrXIfqrTCxKQ=; b=PQmsMnN8fnx1JFKTUCKvu4xVM6Nw3/kjvcKRqP3vsYxorh2x84OVUonQPOpxdQ2MLwZS 13I8cO9C1eQVkHl/z9246DZlhzr2Yk3Y0RH5pIZlpwXN/nfu2HFWO8mdEFmpzYclXWWt ou2WTpIHb+LtYY0BlGLv2US/f40vmfPWDLDZIN4grsPAyP2/JPgQmVQM3LHYE4A/m5Qb qqbaUd/A4KJi12pqGElWLRItyuROng2puL3zssgcr5dHzp4JQBY2d4JnvTmi2Z2gyC9f a4q0tkaFO7NXInThYx+SbUtaFpCmfS17MWki5RDNhK+mtwnlTAKufRdU68Wgm9d/u2hp dg== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ptb9wga7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Apr 2023 06:26:10 +0000 Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3376Q78i014103; Fri, 7 Apr 2023 06:26:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 3ppdpm5y8u-1; Fri, 07 Apr 2023 06:26:07 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3376Q7Dg014096; Fri, 7 Apr 2023 06:26:07 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-dikshita-hyd.qualcomm.com [10.213.110.13]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 3376Q6gc014095; Fri, 07 Apr 2023 06:26:07 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 347544) id 4C4EE1310; Fri, 7 Apr 2023 11:56:06 +0530 (+0530) From: Dikshita Agarwal <quic_dikshita@quicinc.com> To: linux-media@vger.kernel.org, stanimir.k.varbanov@gmail.com, 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, Dikshita Agarwal <quic_dikshita@quicinc.com>, Viswanath Boma <quic_vboma@quicinc.com> Subject: [PATCH v2 1/3] venus: add firmware version based check Date: Fri, 7 Apr 2023 11:55:56 +0530 Message-Id: <1680848758-3947-2-git-send-email-quic_dikshita@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1680848758-3947-1-git-send-email-quic_dikshita@quicinc.com> References: <1680848758-3947-1-git-send-email-quic_dikshita@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: N7f_zeC8PBmW8kb0i6fJplF5ZugAtmIQ X-Proofpoint-ORIG-GUID: N7f_zeC8PBmW8kb0i6fJplF5ZugAtmIQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-07_03,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 mlxlogscore=840 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304070059 X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762499752025641569?= X-GMAIL-MSGID: =?utf-8?q?1762499752025641569?= |
Series |
fix decoder issues with firmware version check
|
|
Commit Message
Dikshita Agarwal
April 7, 2023, 6:25 a.m. UTC
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(-)
Comments
On 7.04.2023 08: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> > --- Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> One extra question: some firmware builds have a TYPE-n suffix like PROD-1 in: 14:VIDEO.VE.6.0-00042-PROD-1 Is the -1 a sign of an incremental build, or some "point release" of a given fw revision? Does it matter as far as this checking function goes? Konrad > 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); > +} > #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); > > dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver); > > @@ -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");
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");
On 9.04.2023 07:18, Stanimir Varbanov wrote: > 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? Whooops, I missed that in my review as well... Looks like the 8916 and 8996 FWs fall under the VIDEO.VE case as well, that's the QC_VERSION_STRING they have.. Perhaps this could be an if (IS_V6) .. else .. Konrad > >> 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"); >
On 11.04.2023 12:59, Konrad Dybcio wrote: > > > On 9.04.2023 07:18, Stanimir Varbanov wrote: >> 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? > Whooops, I missed that in my review as well... > > Looks like the 8916 and 8996 FWs fall under the VIDEO.VE case > as well, that's the QC_VERSION_STRING they have.. On top of that, my 8350 fw reports: F/W version: 14:video-firmware.1.0-3fb5add1d3ac96f8f74facd537845a6ceb5a99e4 Konrad > > Perhaps this could be an > > if (IS_V6) > .. > else > .. > > Konrad >> >>> 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"); >>
On 14.04.2023 01:01, Konrad Dybcio wrote: > > > On 11.04.2023 12:59, Konrad Dybcio wrote: >> >> >> On 9.04.2023 07:18, Stanimir Varbanov wrote: >>> 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? >> Whooops, I missed that in my review as well... >> >> Looks like the 8916 and 8996 FWs fall under the VIDEO.VE case >> as well, that's the QC_VERSION_STRING they have.. > On top of that, my 8350 fw reports: > > F/W version: 14:video-firmware.1.0-3fb5add1d3ac96f8f74facd537845a6ceb5a99e4 FWIW this cryptic version also needs fdata.device_addr = 0 (for reference - failling to do so will never stop the video stream polling) Konrad > > Konrad >> >> Perhaps this could be an >> >> if (IS_V6) >> .. >> else >> .. >> >> Konrad >>> >>>> 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"); >>>
On 4/8/2023 12:45 PM, Konrad Dybcio wrote: > > On 7.04.2023 08: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> >> --- > Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> > > One extra question: some firmware builds have a TYPE-n suffix like > PROD-1 in: > > 14:VIDEO.VE.6.0-00042-PROD-1 > > Is the -1 a sign of an incremental build, or some "point release" of a > given fw revision? Does it matter as far as this checking function > goes? this part of string gets added based on the tool version used to build the firmware. this doesn't matter and can be ignored. Thanks, Dikshita > Konrad >> 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); >> +} >> #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); >> >> dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver); >> >> @@ -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");
On 4/9/2023 10:48 AM, Stanimir Varbanov wrote: > 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 sure, will update. > >> #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? the conditional code above is added only for v6 and v4. The behavior for v1 remain same as before. img_ver = pkt->data > >> dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver); > > this will crash for v1. I didn't get why would it crash, could you pls explain? > >> @@ -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"); >
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); +} #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); dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver); @@ -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");