diff mbox series

[v3] media: venus : hfi: add venus image info into smem

Message ID 1617774437-31293-1-git-send-email-dikshita@codeaurora.org (mailing list archive)
State New
Headers show
Series [v3] media: venus : hfi: add venus image info into smem | expand

Commit Message

Dikshita Agarwal April 7, 2021, 5:47 a.m. UTC
Fill fw version info into smem to be printed as part of
soc info.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>

changes since v2:
- adressed all review comments. 
---
 drivers/media/platform/qcom/venus/hfi_msgs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comments

kernel test robot April 7, 2021, 4:20 p.m. UTC | #1
Hi Dikshita,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.12-rc6 next-20210407]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dikshita-Agarwal/media-venus-hfi-add-venus-image-info-into-smem/20210407-134902
base:   git://linuxtv.org/media_tree.git master
config: microblaze-randconfig-s032-20210407 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://github.com/0day-ci/linux/commit/9e745ec66c39bf1f4fdc56a63f1d1711b99f6af4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dikshita-Agarwal/media-venus-hfi-add-venus-image-info-into-smem/20210407-134902
        git checkout 9e745ec66c39bf1f4fdc56a63f1d1711b99f6af4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=microblaze 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   microblaze-linux-ld: drivers/net/wireless/intel/iwlwifi/pcie/drv.o: in function `iwl_pci_probe':
   (.text+0x324): undefined reference to `iwl_so_trans_cfg'
   microblaze-linux-ld: drivers/media/platform/qcom/venus/hfi_msgs.o: in function `hfi_sys_property_info':
>> (.text+0x11f4): undefined reference to `qcom_smem_get'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Stephen Boyd April 7, 2021, 10:26 p.m. UTC | #2
Quoting Dikshita Agarwal (2021-04-06 22:47:17)
> Fill fw version info into smem to be printed as part of
> soc info.
> 
> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
> 
> changes since v2:
> - adressed all review comments. 
> ---

Please address the krobot errors. Looks like we need a 'depends on
QCOM_SMEM' in the Kconfig for this driver now.
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c
index 06a1908..74cfc4f 100644
--- a/drivers/media/platform/qcom/venus/hfi_msgs.c
+++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
@@ -6,6 +6,7 @@ 
 #include <linux/hash.h>
 #include <linux/list.h>
 #include <linux/slab.h>
+#include <linux/soc/qcom/smem.h>
 #include <media/videobuf2-v4l2.h>
 
 #include "core.h"
@@ -14,6 +15,10 @@ 
 #include "hfi_msgs.h"
 #include "hfi_parser.h"
 
+#define SMEM_IMG_VER_TBL 469
+#define VER_STR_SZ	128
+#define SMEM_IMG_OFFSET_VENUS (14 * 128)
+
 static void event_seq_changed(struct venus_core *core, struct venus_inst *inst,
 			      struct hfi_msg_event_notify_pkt *pkt)
 {
@@ -239,15 +244,27 @@  static void
 sys_get_prop_image_version(struct device *dev,
 			   struct hfi_msg_sys_property_info_pkt *pkt)
 {
+	u8 *smem_tbl_ptr;
+	u8 *img_ver;
 	int req_bytes;
+	size_t smem_blk_sz;
 
 	req_bytes = pkt->hdr.size - sizeof(*pkt);
 
-	if (req_bytes < 128 || !pkt->data[1] || pkt->num_properties > 1)
+	if (req_bytes < VER_STR_SZ || !pkt->data[1] || pkt->num_properties > 1)
 		/* bad packet */
 		return;
 
-	dev_dbg(dev, VDBGL "F/W version: %s\n", (u8 *)&pkt->data[1]);
+	img_ver = (u8 *)&pkt->data[1];
+
+	dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver);
+
+	smem_tbl_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
+		SMEM_IMG_VER_TBL, &smem_blk_sz);
+	if (smem_tbl_ptr &&
+	    smem_blk_sz >= SMEM_IMG_OFFSET_VENUS + VER_STR_SZ)
+		memcpy(smem_tbl_ptr + SMEM_IMG_OFFSET_VENUS,
+		       img_ver, VER_STR_SZ);
 }
 
 static void hfi_sys_property_info(struct venus_core *core,