Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp205926pxf; Wed, 24 Mar 2021 03:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV7hR5pqlHVpZuRnm4sY2qR+t6/MKEz2KYvMnDTMQalz2VPz6IsErarjR7KtxHEW632nGv X-Received: by 2002:a05:6402:312b:: with SMTP id dd11mr2514071edb.149.1616580613984; Wed, 24 Mar 2021 03:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616580613; cv=none; d=google.com; s=arc-20160816; b=te1Zee6/c9swCD+YO7sKQBXjvCeodATe916iTK0189VW7CTvxtIT/ywNHdAXWIje01 zYiUvM5K5PQfIC2ZnQ8/3xVOKM1oIhxz/+fvtXw8mqCo+BLXvPA9qv6KbJ47PpfFYn2n uhocTBir5VEHcaOkSw0MrAOWVc4Fs0HlWsCusrt+n0oXezOqPWwMz2XjkmDafRITw2T4 EUtrLmlu3R/B8hIz2LnowK/DuVe9H2t1D3P4cyZjY4AAdb/qslxs7M58sWHmhcEBVriP /ruoLYVhkiBK3ctXHU2PB86hVo0FghrheK+fF8e4bfZVerxJNx8kCu/1uLsd4hLBn9nx tjXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=L7in4zMNdZBc1GxLcnECgmkXR6YAII8UXVAv+IYWr9s=; b=vkx4sip2dQJxemeYQo3zeYwYWhQ7oEv0tH6C/6WTKesMDFh0mXTFVgeWbspcLrTjfw 2Tf+JVKTy8z29jPLZqFLp83mROT5A2r4wfvqBkXFQcwCtrzFdk592YdssPs16Rh5GqoZ hxZweXAfmXkYbDeVeYG8AoVqfRikmE0v4gPgnPWOkHvs75U3wHkeVQITrmgm7loKm9hq Fccc7SeSijKT48Ov7sWXiwfCVTrn8jbOINbT9R1LkYPKA0QpaU4rm0o3gmRKAgzhmrsG dkipXY6j7Y1hZmMQd0F557EmutzMXgesqNFtyHPqTQdPEKH5lPxukEjez7nL6MXKOuAS G5bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="nAUos0/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si1388893ejj.303.2021.03.24.03.09.50; Wed, 24 Mar 2021 03:10:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="nAUos0/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbhCXGcv (ORCPT + 99 others); Wed, 24 Mar 2021 02:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbhCXGcl (ORCPT ); Wed, 24 Mar 2021 02:32:41 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF81C0613DB for ; Tue, 23 Mar 2021 23:32:41 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso643324pjb.3 for ; Tue, 23 Mar 2021 23:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=L7in4zMNdZBc1GxLcnECgmkXR6YAII8UXVAv+IYWr9s=; b=nAUos0/1sE5Lk8+Ki56nM1Qm5MHroKWX0tekqp9IenEnrLL1pUDMRtqPL05UGkOQhT BviFz134utRDij4/zmq+KBoveP+J5Azz3OaNBrHQeesm3MUdgq1jF0Ea2uDxdSdOhmAX /Yp3JAp29Xm6tXZFHj6Xucofys2cEVkzKToPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=L7in4zMNdZBc1GxLcnECgmkXR6YAII8UXVAv+IYWr9s=; b=LjV9IqtipM2I8Md7xk4QFobZZG4R3aYoRZzQ1AkOXkYwXCHvrpMFL6bJN3LUc16OP5 c8C/xUfYtxh/WbCggf8GQXrSAMBzPgbwSbSae0wHcLKRQiNMQPPOeqXUgTY2Vovvbrba /QJmDoeI0g2OwbmNz5sUFF1WM3cGoHkYkz3No5c3WO/I79vRtIdO7b6sgWFYWwM0CZ8u wUeU1iYjfI4ClNM2aLjcZhGHaosocBqmAcyasU6kK9rHO1vmuFvBSe82Tzpn+cLifqxv BkImBuZeiz9REwyWGu75MkH2H/beEqk7T51MPy5Ze4pVQQvfxWF7zeMoLQuAw46dFumu binQ== X-Gm-Message-State: AOAM530cFxq40pXnGW9ZOven4Rf1Sd6E02sZvnf5eH9lzl6BtlhOzl+z gFTNcKcEfwmsFFADohLw5tjkV0V6Ky9jSQ== X-Received: by 2002:a17:90a:5b11:: with SMTP id o17mr1992274pji.32.1616567560296; Tue, 23 Mar 2021 23:32:40 -0700 (PDT) Received: from chromium.org ([2620:15c:202:201:84ac:62f7:16a8:ccc7]) by smtp.gmail.com with ESMTPSA id w79sm1210900pfc.87.2021.03.23.23.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 23:32:39 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1616564457-25221-1-git-send-email-dikshita@codeaurora.org> References: <1616564457-25221-1-git-send-email-dikshita@codeaurora.org> Subject: Re: [PATCH] media: venus : hfi: add venus image info into smem From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal To: Dikshita Agarwal , linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Date: Tue, 23 Mar 2021 23:32:38 -0700 Message-ID: <161656755819.3012082.9032882357160965681@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Dikshita Agarwal (2021-03-23 22:40:57) > fill fw version info into smem to be printed as part of s/fill/Fill/ > soc info. >=20 > Signed-off-by: Dikshita Agarwal > --- > drivers/media/platform/qcom/venus/hfi_msgs.c | 36 ++++++++++++++++++++++= ++++-- > 1 file changed, 34 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media= /platform/qcom/venus/hfi_msgs.c > index 06a1908..0e94921 100644 > --- a/drivers/media/platform/qcom/venus/hfi_msgs.c > +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c > @@ -239,15 +242,44 @@ static void > sys_get_prop_image_version(struct device *dev, > struct hfi_msg_sys_property_info_pkt *pkt) > { > + u32 i =3D 0; > + size_t smem_block_size =3D 0; > + u8 *smem_table_ptr; > + char version[256]; > + const u32 version_string_size =3D 128; > + const u32 smem_image_index_venus =3D 14 * 128; Can these be #defines instead of local const variables? > + u8 *str_image_version; > int req_bytes; > =20 > req_bytes =3D pkt->hdr.size - sizeof(*pkt); > =20 > - if (req_bytes < 128 || !pkt->data[1] || pkt->num_properties > 1) > + if (req_bytes < version_string_size || !pkt->data[1] || pkt->num_= properties > 1) > /* bad packet */ > return; > =20 > - dev_dbg(dev, VDBGL "F/W version: %s\n", (u8 *)&pkt->data[1]); Why is pkt->data not already a u8? > + str_image_version =3D (u8 *)&pkt->data[1]; > + > + /* > + * The version string returned by firmware includes null > + * characters at the start and in between. Replace the null > + * characters with space, to print the version info. > + */ > + for (i =3D 0; i < version_string_size; i++) { > + if (str_image_version[i] !=3D '\0') > + version[i] =3D str_image_version[i]; > + else > + version[i] =3D ' '; > + } > + > + version[i] =3D '\0'; > + dev_dbg(dev, VDBGL "F/W version: %s\n", version); Instead of replacing the string with spaces can we find the first non-null character up to version_string_size and then stash a pointer to that and print it out with dev_dbg()? That would save 256 bytes on the stack for something that is presumably a string and will be NUL terminated. > + > + smem_table_ptr =3D qcom_smem_get(QCOM_SMEM_HOST_ANY, > + SMEM_IMAGE_VERSION_TABLE, &smem_bl= ock_size); > + if ((smem_image_index_venus + version_string_size) <=3D smem_bloc= k_size && > + smem_table_ptr) > + memcpy(smem_table_ptr + smem_image_index_venus, > + str_image_version, version_string_size); It would be nice to have shorter variable names so this was an if (condition1 && condition2) memcpy();