From patchwork Sat Jun 13 22:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 187917 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1544476ilo; Sat, 13 Jun 2020 15:39:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3X5jyZmZQchPGfC6f2MfYiz0R4EfVN2IIEXC05DMfRA9AR4mt9/dDn8Hjsmiv9TMaDGLA X-Received: by 2002:a17:906:4548:: with SMTP id s8mr18509252ejq.519.1592087983402; Sat, 13 Jun 2020 15:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592087983; cv=none; d=google.com; s=arc-20160816; b=BlRounwq35EAhRhYg14o4VKk/E0rhlV2oreJ8WG/x9oI/1NFCJA0Gy/2+wWmhq9lcR MJmcfKeEP2To3HaIgDhzgAR7nRBnfkqeHBesKsV8+L8PnvQnk3K/SyK/89ungQJqR1oF SwvxALx3LTz3xT0gz+FrdUZBZwHcjnM3rwTmkNIVvc8FJS8NN6/GIzYZW4CEdFwVKQ7P 6k/l9t9P9ollzWifzjqG2l8Xka82ZB1ii7IN/ruDbHy5RgFUVvcH3fXKIbXdoGP2CAtm Mil0qBhi57oZm0a4XbOOsfgd4pJ6s7rVsKtdGoCHFrLL272GZlLcbds8/b6FpqZM4YJ/ tP8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=y/kPc47OoadaJ4JaJgZRCf1efGLXg0vrEdfBGdX8oHk=; b=yK506iBtF1w3IQJZIYy5rICk4eqMKDM67L6iOLmvwvj+Qdw8cYE/vK61X1GGQSvHUJ 27EtL0qe+2/SiDYZ81YQex08pg5MD3RqY9qAU2S+ShO8UWR8z50AIc6QELYWxgzSlDCQ HHEaWouplgdPnuT4umWT4Z8GgmBbY+2uiWUR6NYa0YtBy+2HYVexCqS5foZAxBhCPMbk nosuIPQainotwz3QXV2ks85ZFxqJ4V1C6p02Sfho25EQ32amS3S0EnOaoSNbt6z41eee YbetyeKBIEjrOlm8CZQX59gbVrDxXMbxddjkQyBNt0VTmrbiqq8//+gD9u14Ee6Vq+cr mVTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sP8VBnE6; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si3663008eja.734.2020.06.13.15.39.43; Sat, 13 Jun 2020 15:39:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=sP8VBnE6; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgFMWjl (ORCPT + 16 others); Sat, 13 Jun 2020 18:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbgFMWjj (ORCPT ); Sat, 13 Jun 2020 18:39:39 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FDFC08C5C2 for ; Sat, 13 Jun 2020 15:39:38 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id l27so13637411ejc.1 for ; Sat, 13 Jun 2020 15:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y/kPc47OoadaJ4JaJgZRCf1efGLXg0vrEdfBGdX8oHk=; b=sP8VBnE6KL+vhlTDJWA7+nPHE4LQR+hYhn8Y/TdIdVC+maPvO/3HdBMjC7m9jXKQDU Ul59n7bk84bFkLoyddJG0tJhfsw1a0bSrZlXv1vrs02JODpBx1phWQYwHaRYljHuajNB 0ua3F9OD8uYlDJmlqKy/yaIFVEshCOTNsMH6k57xe48nNnSueEmy2wJfAtcdExaS/eEM L/c0srRxJ/z8TpgBLsz8z3FDB+9OZdqkY+uWiFT3Y0lJy3MgyTvt4LEDIr583iReJJMn T9oiApxmGqbYzKMz7rWciHWmlkd1C0WiySnMFq4tErSjBpmrnVs13ZpR+mxhj0gVptfi RByQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/kPc47OoadaJ4JaJgZRCf1efGLXg0vrEdfBGdX8oHk=; b=XgktXVZf8us80N/SUyaqpF3MKfDB925RUcFkflWSo2gJ0oKNvRAOQ99+08ZifGL6NB tQzIq8w0t4onyGn7qlOjgJcglW+Ppe68h7RFmUz76cIgCWv45W+yiA46gkVZp0ZFOHG1 MHGadiiOVp3amIAnMmzsHSkKNJuD1KovR7RDNv/K0pXrtTDfT8u95dr+Z9DJFB9Lib1y vyl80RkSVTgSfK+gp5F8bdMcmZDOGu3NEQMvoole33WIHCUtyeaEtcF9QIeiAE3bQDaT 2rk9VvwupHI/MK7lmYECfkUIVu3N29YMIHh4+6OlAIQyc0vZCVsVFNazaXEG5CF2VPQw TC4g== X-Gm-Message-State: AOAM533YHwB0+DfkuF6Rv+cyJYGrm/PO9O5L8wYfZ5xqlcOUyxVbsTWQ /XnamtjLWa+SdgofkjTiOBcjzg== X-Received: by 2002:a17:906:63c9:: with SMTP id u9mr19829717ejk.439.1592087976806; Sat, 13 Jun 2020 15:39:36 -0700 (PDT) Received: from localhost.localdomain (212-5-158-38.ip.btc-net.bg. [212.5.158.38]) by smtp.gmail.com with ESMTPSA id u3sm5581606edx.25.2020.06.13.15.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 15:39:36 -0700 (PDT) From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Stanimir Varbanov Subject: [PATCH v4 1/3] venus: Add debugfs interface to set firmware log level Date: Sun, 14 Jun 2020 01:39:17 +0300 Message-Id: <20200613223919.7038-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200613223919.7038-1-stanimir.varbanov@linaro.org> References: <20200613223919.7038-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This will be useful when debugging specific issues related to firmware HFI interface. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/Makefile | 2 +- drivers/media/platform/qcom/venus/core.c | 3 +++ drivers/media/platform/qcom/venus/core.h | 3 +++ drivers/media/platform/qcom/venus/dbgfs.c | 21 +++++++++++++++++++ drivers/media/platform/qcom/venus/dbgfs.h | 12 +++++++++++ drivers/media/platform/qcom/venus/hfi_venus.c | 7 ++++++- 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 drivers/media/platform/qcom/venus/dbgfs.c create mode 100644 drivers/media/platform/qcom/venus/dbgfs.h -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/Makefile b/drivers/media/platform/qcom/venus/Makefile index 64af0bc1edae..dfc636865709 100644 --- a/drivers/media/platform/qcom/venus/Makefile +++ b/drivers/media/platform/qcom/venus/Makefile @@ -3,7 +3,7 @@ venus-core-objs += core.o helpers.o firmware.o \ hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \ - hfi_parser.o pm_helpers.o + hfi_parser.o pm_helpers.o dbgfs.o venus-dec-objs += vdec.o vdec_ctrls.o venus-enc-objs += venc.o venc_ctrls.o diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 203c6538044f..249141e27fea 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -290,6 +290,8 @@ static int venus_probe(struct platform_device *pdev) if (ret) goto err_dev_unregister; + venus_dbgfs_init(core); + return 0; err_dev_unregister: @@ -337,6 +339,7 @@ static int venus_remove(struct platform_device *pdev) v4l2_device_unregister(&core->v4l2_dev); mutex_destroy(&core->pm_lock); mutex_destroy(&core->lock); + venus_dbgfs_deinit(core); return ret; } diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7118612673c9..b48782f9aa95 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -12,6 +12,7 @@ #include #include +#include "dbgfs.h" #include "hfi.h" #define VIDC_CLKS_NUM_MAX 4 @@ -136,6 +137,7 @@ struct venus_caps { * @priv: a private filed for HFI operations * @ops: the core HFI operations * @work: a delayed work for handling system fatal error + * @root: debugfs root directory */ struct venus_core { void __iomem *base; @@ -185,6 +187,7 @@ struct venus_core { unsigned int codecs_count; unsigned int core0_usage_count; unsigned int core1_usage_count; + struct dentry *root; }; struct vdec_controls { diff --git a/drivers/media/platform/qcom/venus/dbgfs.c b/drivers/media/platform/qcom/venus/dbgfs.c new file mode 100644 index 000000000000..782d54ac1b8f --- /dev/null +++ b/drivers/media/platform/qcom/venus/dbgfs.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 Linaro Ltd. + */ + +#include + +#include "core.h" + +extern int venus_fw_debug; + +void venus_dbgfs_init(struct venus_core *core) +{ + core->root = debugfs_create_dir("venus", NULL); + debugfs_create_x32("fw_level", 0644, core->root, &venus_fw_debug); +} + +void venus_dbgfs_deinit(struct venus_core *core) +{ + debugfs_remove_recursive(core->root); +} diff --git a/drivers/media/platform/qcom/venus/dbgfs.h b/drivers/media/platform/qcom/venus/dbgfs.h new file mode 100644 index 000000000000..b7b621a8472f --- /dev/null +++ b/drivers/media/platform/qcom/venus/dbgfs.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2020 Linaro Ltd. */ + +#ifndef __VENUS_DBGFS_H__ +#define __VENUS_DBGFS_H__ + +struct venus_core; + +void venus_dbgfs_init(struct venus_core *core); +void venus_dbgfs_deinit(struct venus_core *core); + +#endif diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 0d8855014ab3..3a04b08ab85a 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -130,7 +130,7 @@ struct venus_hfi_device { }; static bool venus_pkt_debug; -static int venus_fw_debug = HFI_DEBUG_MSG_ERROR | HFI_DEBUG_MSG_FATAL; +int venus_fw_debug = HFI_DEBUG_MSG_ERROR | HFI_DEBUG_MSG_FATAL; static bool venus_sys_idle_indicator; static bool venus_fw_low_power_mode = true; static int venus_hw_rsp_timeout = 1000; @@ -1130,9 +1130,14 @@ static int venus_session_init(struct venus_inst *inst, u32 session_type, u32 codec) { struct venus_hfi_device *hdev = to_hfi_priv(inst->core); + struct device *dev = hdev->core->dev; struct hfi_session_init_pkt pkt; int ret; + ret = venus_sys_set_debug(hdev, venus_fw_debug); + if (ret) + dev_warn(dev, "setting fw debug msg ON failed (%d)\n", ret); + ret = pkt_session_init(&pkt, inst, session_type, codec); if (ret) goto err; From patchwork Sat Jun 13 22:39:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 187918 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1544484ilo; Sat, 13 Jun 2020 15:39:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH34P9AtWRUHvj68trRzG3TnOuKkH9D9M0OxXLUs78PPjvBglbtzy2PqboTHWx+n0okczi X-Received: by 2002:a17:906:f257:: with SMTP id gy23mr7054688ejb.370.1592087985021; Sat, 13 Jun 2020 15:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592087985; cv=none; d=google.com; s=arc-20160816; b=pcoBZSNLYYNa4Co0H+zFHi5TLVHVCLmJEb3A5LH9NYrOpCNw6UNvPQhdkIQtX4UjC5 tbvB2KMiE7eGVkZUKqzsOOqMpvWrCmhSHRkEVYF4pJKsuLz1lMqbnyOxMwxkZCZ8QN0n JbbwuaVDRm8zCUy4ai8i7enkOD+7TkxFaSFNCVD/3pLnK45jy1F874ltX2dA6wUZZBo8 SMKPVPCIHZd8SeIy/WNRjrNBEJLMlkVFYCS1LOsc5MWv+HEeH7BlcCtKZ7E1g/ozUjtL 4mc50wWsAKc39a6PH7c2XHP/RoP8YK8VxmJvbVu2wsJ8lwLmRg3mEutgABaqLQ6Y5/cY SQJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ftlzwdWtANipR1qsJhtVEUlQeP1yP990SuyUBKuypzw=; b=ryOqf9+q44YxnlkRoezs56fY8fJWYT0C/R+NT+bdDa+fghhXOwgrJrPBDEHOHNY3eO uXKY/uJ9Bm8GqtUSg1EziahBN2C/GiBIMm8yAzrfQ6E7Ey8WT74HC9z6uQ7PEqum3pAR VK0exKV/weCsKpYFK+97HEaD0e9fL3UEqXrGR8gVT21xXHCyJcfASmvM6amegPo/oK3z 7eU3uf/6eSuft/t3SRI9R9M5h5Az5RpmTwOOiIKwM12nEUNee9DtcDkUsZLK27HwMKyC HJf9XWvDGjuogLQK20VWhrZW5LwpTusum8R6IMlnV6omwyXjn29aMG+S3BRYozGUA1KZ l2Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SAQV5QkH; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si3663008eja.734.2020.06.13.15.39.44; Sat, 13 Jun 2020 15:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=SAQV5QkH; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726833AbgFMWjn (ORCPT + 16 others); Sat, 13 Jun 2020 18:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbgFMWjl (ORCPT ); Sat, 13 Jun 2020 18:39:41 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0CC4C08C5C3 for ; Sat, 13 Jun 2020 15:39:40 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id dr13so13587048ejc.3 for ; Sat, 13 Jun 2020 15:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ftlzwdWtANipR1qsJhtVEUlQeP1yP990SuyUBKuypzw=; b=SAQV5QkHxmu0dvz0S52q15eszZ4F+u/1AuO1FLEAsPoF75CSFXmNrYUKF0+BJdqPex C/iJ/3V/CeemIHckiRgntj1O29/f8kbhBtq124+jNz7s+3sKihb9f4Q3SOLkrJpH1oie 8hAd44WO/w+kDVFqnUWFI+dx8QFZjDCsCupw5z5a6kZgmghLBVYuq5o7hU0KaF04kYK/ p+SsDdj+/ZTLQ8F7GeSJJ1nwa9JRZV0dJaZdSNZ+jVoiP3nrLYXyNveacph+W1sZlWY2 C1gFduYkpmbXpLXTaTduE+zCnI5WiqkUDJeoqZJRIFvtg5Qhu6PCz3WEWUnPls1LvINm GGtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ftlzwdWtANipR1qsJhtVEUlQeP1yP990SuyUBKuypzw=; b=aoN7ORx04nCgYEvGv9bIiCT3fMdP/GBCqpldUZUqpBet9LilO3+LJc5CQORSs1ncgj KNOxPjc1ngiZ8ZE5WolXwzoUwRla0YTQ9ynEAZvJ0ZcncGxl14yOTBxFqIbnNbqNXQ1p gXpUPplHERFy4/apPb0ATmEuUQ9frErpS0ZeNf26VT3hJqCPEC0o4r0Smr/NcAflNA6g P8HiHlNt0gYSpIG9JiNNZ+8W/8eVXLNOeh8OWPi3beVSt5txIwzoDoNBYoekuXIPAZj5 IOyi0sDx6IbbWGFA9aSRIdpNheUUVc7gl1KAC5yABgxaKjFjT9VBmR3AGAUE68b6u3lT OX6A== X-Gm-Message-State: AOAM533CNRUqao1NbrpEr+gS5RfYipuMad05tbIWndNUuSfttoyTmZsn GmEspK3IDH+f56PghrQlu1uYUA== X-Received: by 2002:a17:906:b74f:: with SMTP id fx15mr19080124ejb.289.1592087978944; Sat, 13 Jun 2020 15:39:38 -0700 (PDT) Received: from localhost.localdomain (212-5-158-38.ip.btc-net.bg. [212.5.158.38]) by smtp.gmail.com with ESMTPSA id u3sm5581606edx.25.2020.06.13.15.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 15:39:38 -0700 (PDT) From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Stanimir Varbanov Subject: [PATCH v4 2/3] venus: Make debug infrastructure more flexible Date: Sun, 14 Jun 2020 01:39:18 +0300 Message-Id: <20200613223919.7038-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200613223919.7038-1-stanimir.varbanov@linaro.org> References: <20200613223919.7038-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Here we introduce few debug macros with levels (low, medium and high) and debug macro for firmware. Enabling the particular level will be done by dynamic debug. For example to enable debug messages with low level: echo 'format "VENUSL" +p' > debugfs/dynamic_debug/control If you want to enable all levels: echo 'format "VENUS" +p' > debugfs/dynamic_debug/control All the features which dynamic debugging provide are preserved. And finaly all dev_dbg are translated to VDBGX with appropriate debug levels. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 5 ++ drivers/media/platform/qcom/venus/helpers.c | 2 +- drivers/media/platform/qcom/venus/hfi_msgs.c | 30 ++++----- drivers/media/platform/qcom/venus/hfi_venus.c | 20 ++++-- .../media/platform/qcom/venus/pm_helpers.c | 3 +- drivers/media/platform/qcom/venus/vdec.c | 63 +++++++++++++++++-- drivers/media/platform/qcom/venus/venc.c | 4 ++ 7 files changed, 96 insertions(+), 31 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b48782f9aa95..82438f19afba 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -15,6 +15,11 @@ #include "dbgfs.h" #include "hfi.h" +#define VDBGL(fmt, args...) pr_debug("VENUSL: " fmt, ##args) +#define VDBGM(fmt, args...) pr_debug("VENUSM: " fmt, ##args) +#define VDBGH(fmt, args...) pr_debug("VENUSH: " fmt, ##args) +#define VDBGFW(fmt, args...) pr_debug("VENUSFW: " fmt, ##args) + #define VIDC_CLKS_NUM_MAX 4 #define VIDC_VCODEC_CLKS_NUM_MAX 2 #define VIDC_PMDOMAINS_NUM_MAX 3 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 0143af7822b2..115a9a2af1d6 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -396,7 +396,7 @@ put_ts_metadata(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) } if (slot == -1) { - dev_dbg(inst->core->dev, "%s: no free slot\n", __func__); + VDBGH("no free slot for timestamp\n"); return; } diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 279a9d6fe737..36986d402c96 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -138,10 +138,9 @@ static void event_sys_error(struct venus_core *core, u32 event, struct hfi_msg_event_notify_pkt *pkt) { if (pkt) - dev_dbg(core->dev, - "sys error (session id:%x, data1:%x, data2:%x)\n", - pkt->shdr.session_id, pkt->event_data1, - pkt->event_data2); + VDBGH("sys error (session id: %x, data1: %x, data2: %x)\n", + pkt->shdr.session_id, pkt->event_data1, + pkt->event_data2); core->core_ops->event_notify(core, event); } @@ -152,8 +151,8 @@ event_session_error(struct venus_core *core, struct venus_inst *inst, { struct device *dev = core->dev; - dev_dbg(dev, "session error: event id:%x, session id:%x\n", - pkt->event_data1, pkt->shdr.session_id); + VDBGH("session error: event id: %x, session id: %x\n", + pkt->event_data1, pkt->shdr.session_id); if (!inst) return; @@ -236,8 +235,7 @@ static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst, } static void -sys_get_prop_image_version(struct device *dev, - struct hfi_msg_sys_property_info_pkt *pkt) +sys_get_prop_image_version(struct hfi_msg_sys_property_info_pkt *pkt) { int req_bytes; @@ -247,26 +245,25 @@ sys_get_prop_image_version(struct device *dev, /* bad packet */ return; - dev_dbg(dev, "F/W version: %s\n", (u8 *)&pkt->data[1]); + VDBGL("F/W version: %s\n", (u8 *)&pkt->data[1]); } static void hfi_sys_property_info(struct venus_core *core, struct venus_inst *inst, void *packet) { struct hfi_msg_sys_property_info_pkt *pkt = packet; - struct device *dev = core->dev; if (!pkt->num_properties) { - dev_dbg(dev, "%s: no properties\n", __func__); + VDBGM("no properties\n"); return; } switch (pkt->data[0]) { case HFI_PROPERTY_SYS_IMAGE_VERSION: - sys_get_prop_image_version(dev, pkt); + sys_get_prop_image_version(pkt); break; default: - dev_dbg(dev, "%s: unknown property data\n", __func__); + VDBGM("unknown property data\n"); break; } } @@ -297,7 +294,7 @@ static void hfi_sys_ping_done(struct venus_core *core, struct venus_inst *inst, static void hfi_sys_idle_done(struct venus_core *core, struct venus_inst *inst, void *packet) { - dev_dbg(core->dev, "sys idle\n"); + VDBGL("sys idle\n"); } static void hfi_sys_pc_prepare_done(struct venus_core *core, @@ -305,7 +302,7 @@ static void hfi_sys_pc_prepare_done(struct venus_core *core, { struct hfi_msg_sys_pc_prep_done_pkt *pkt = packet; - dev_dbg(core->dev, "pc prepare done (error %x)\n", pkt->error_type); + VDBGL("pc prepare done (error %x)\n", pkt->error_type); } static unsigned int @@ -387,8 +384,7 @@ static void hfi_session_prop_info(struct venus_core *core, case HFI_PROPERTY_CONFIG_VDEC_ENTROPY: break; default: - dev_dbg(dev, "%s: unknown property id:%x\n", __func__, - pkt->data[0]); + VDBGH("unknown property id: %x\n", pkt->data[0]); return; } diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 3a04b08ab85a..9aef62f9b59a 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -467,7 +467,6 @@ static int venus_boot_core(struct venus_hfi_device *hdev) static u32 venus_hwversion(struct venus_hfi_device *hdev) { - struct device *dev = hdev->core->dev; u32 ver = venus_readl(hdev, WRAPPER_HW_VERSION); u32 major, minor, step; @@ -477,7 +476,7 @@ static u32 venus_hwversion(struct venus_hfi_device *hdev) minor = minor >> WRAPPER_HW_VERSION_MINOR_VERSION_SHIFT; step = ver & WRAPPER_HW_VERSION_STEP_VERSION_MASK; - dev_dbg(dev, "venus hw version %x.%x.%x\n", major, minor, step); + VDBGL("venus hw version %x.%x.%x\n", major, minor, step); return major; } @@ -897,7 +896,6 @@ static int venus_session_cmd(struct venus_inst *inst, u32 pkt_type) static void venus_flush_debug_queue(struct venus_hfi_device *hdev) { - struct device *dev = hdev->core->dev; void *packet = hdev->dbg_buf; while (!venus_iface_dbgq_read(hdev, packet)) { @@ -906,7 +904,7 @@ static void venus_flush_debug_queue(struct venus_hfi_device *hdev) if (pkt->hdr.pkt_type != HFI_MSG_SYS_COV) { struct hfi_msg_sys_debug_pkt *pkt = packet; - dev_dbg(dev, "%s", pkt->msg_data); + VDBGFW("%s", pkt->msg_data); } } } @@ -1230,6 +1228,11 @@ static int venus_session_etb(struct venus_inst *inst, ret = -EINVAL; } + VDBGM("etb: %s: itag: %u, flen: %u, addr: %x\n", + session_type == VIDC_SESSION_TYPE_DEC ? "dec" : "enc", + in_frame->clnt_data, in_frame->filled_len, + in_frame->device_addr); + return ret; } @@ -1244,7 +1247,14 @@ static int venus_session_ftb(struct venus_inst *inst, if (ret) return ret; - return venus_iface_cmdq_write(hdev, &pkt); + ret = venus_iface_cmdq_write(hdev, &pkt); + + VDBGM("ftb: %s: otag: %u, flen: %u, addr: %x\n", + inst->session_type == VIDC_SESSION_TYPE_DEC ? "dec" : "enc", + out_frame->clnt_data, out_frame->filled_len, + out_frame->device_addr); + + return ret; } static int venus_session_set_buffers(struct venus_inst *inst, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index abf93158857b..ec7394615ef8 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -212,8 +212,7 @@ static int load_scale_bw(struct venus_core *core) } mutex_unlock(&core->lock); - dev_dbg(core->dev, "total: avg_bw: %u, peak_bw: %u\n", - total_avg, total_peak); + VDBGL("total: avg_bw: %u, peak_bw: %u\n", total_avg, total_peak); return icc_set_bw(core->video_path, total_avg, total_peak); } diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 7c4c483d5438..7959e452fbf3 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -225,7 +225,7 @@ static int vdec_check_src_change(struct venus_inst *inst) if (!(inst->codec_state == VENUS_DEC_STATE_CAPTURE_SETUP) || !inst->reconfig) - dev_dbg(inst->core->dev, "%s: wrong state\n", __func__); + VDBGM("wrong codec state %u\n", inst->codec_state); done: return 0; @@ -790,6 +790,10 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int in_num, out_num; int ret = 0; + VDBGM("vb2: queue_setup: %s: begin (codec_state: %u)\n", + V4L2_TYPE_IS_OUTPUT(q->type) ? "out" : "cap", + inst->codec_state); + if (*num_planes) { unsigned int output_buf_size = venus_helper_get_opb_size(inst); @@ -859,6 +863,10 @@ static int vdec_queue_setup(struct vb2_queue *q, break; } + VDBGM("vb2: queue_setup: %s: end (codec_state: %u, ret: %d)\n", + V4L2_TYPE_IS_OUTPUT(q->type) ? "out" : "cap", + inst->codec_state, ret); + return ret; put_power: @@ -897,6 +905,8 @@ static int vdec_start_capture(struct venus_inst *inst) { int ret; + VDBGM("on: cap: begin (codec_state: %u)\n", inst->codec_state); + if (!inst->streamon_out) return 0; @@ -955,11 +965,16 @@ static int vdec_start_capture(struct venus_inst *inst) inst->sequence_cap = 0; inst->reconfig = false; + VDBGM("on: cap: end (codec_state: %u)\n", inst->codec_state); + return 0; free_dpb_bufs: venus_helper_free_dpb_bufs(inst); err: + VDBGM("on: cap: end (codec_state: %u, ret: %d)\n", + inst->codec_state, ret); + return ret; } @@ -967,6 +982,8 @@ static int vdec_start_output(struct venus_inst *inst) { int ret; + VDBGM("on: out: begin (codec_state: %u)\n", inst->codec_state); + if (inst->codec_state == VENUS_DEC_STATE_SEEK) { ret = venus_helper_process_initial_out_bufs(inst); inst->codec_state = VENUS_DEC_STATE_DECODING; @@ -1015,6 +1032,10 @@ static int vdec_start_output(struct venus_inst *inst) done: inst->streamon_out = 1; + + VDBGM("on: out: end (codec_state: %u, ret: %d)\n", + inst->codec_state, ret); + return ret; } @@ -1069,6 +1090,8 @@ static int vdec_stop_capture(struct venus_inst *inst) { int ret = 0; + VDBGM("off: cap: begin (codec_state: %u)\n", inst->codec_state); + switch (inst->codec_state) { case VENUS_DEC_STATE_DECODING: ret = hfi_session_flush(inst, HFI_FLUSH_ALL, true); @@ -1090,6 +1113,9 @@ static int vdec_stop_capture(struct venus_inst *inst) INIT_LIST_HEAD(&inst->registeredbufs); + VDBGM("off: cap: end (codec_state: %u, ret: %d)\n", + inst->codec_state, ret); + return ret; } @@ -1097,6 +1123,8 @@ static int vdec_stop_output(struct venus_inst *inst) { int ret = 0; + VDBGM("off: out: begin (codec_state: %u)\n", inst->codec_state); + switch (inst->codec_state) { case VENUS_DEC_STATE_DECODING: case VENUS_DEC_STATE_DRAIN: @@ -1112,6 +1140,9 @@ static int vdec_stop_output(struct venus_inst *inst) break; } + VDBGM("off: out: end (codec_state: %u, ret %d)\n", + inst->codec_state, ret); + return ret; } @@ -1146,6 +1177,8 @@ static void vdec_session_release(struct venus_inst *inst) struct venus_core *core = inst->core; int ret, abort = 0; + VDBGM("rel: begin (codec_state: %u)\n", inst->codec_state); + vdec_pm_get(inst); mutex_lock(&inst->lock); @@ -1175,15 +1208,23 @@ static void vdec_session_release(struct venus_inst *inst) venus_pm_release_core(inst); vdec_pm_put(inst, false); + + VDBGM("rel: end (codec_state: %u)\n", inst->codec_state); } static int vdec_buf_init(struct vb2_buffer *vb) { struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + int ret; inst->buf_count++; - return venus_helper_vb2_buf_init(vb); + ret = venus_helper_vb2_buf_init(vb); + + VDBGM("vb2: buf_init: %s: done (codec_state: %u)\n", + V4L2_TYPE_IS_OUTPUT(vb->type) ? "out" : "cap", inst->codec_state); + + return ret; } static void vdec_buf_cleanup(struct vb2_buffer *vb) @@ -1193,6 +1234,9 @@ static void vdec_buf_cleanup(struct vb2_buffer *vb) inst->buf_count--; if (!inst->buf_count) vdec_session_release(inst); + + VDBGM("vb2: buf_cleanup: %s: done (codec_state: %u)\n", + V4L2_TYPE_IS_OUTPUT(vb->type) ? "out" : "cap", inst->codec_state); } static void vdec_vb2_buf_queue(struct vb2_buffer *vb) @@ -1281,6 +1325,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, } v4l2_m2m_buf_done(vbuf, state); + + VDBGH("done: %s, idx: %02u, flen: %08u, flags: hfi: %08x, v4l2: %08x\n", + V4L2_TYPE_IS_OUTPUT(type) ? "out" : "cap", + vbuf->vb2_buf.index, bytesused, hfi_flags, vbuf->flags); } static void vdec_event_change(struct venus_inst *inst, @@ -1289,7 +1337,6 @@ static void vdec_event_change(struct venus_inst *inst, static const struct v4l2_event ev = { .type = V4L2_EVENT_SOURCE_CHANGE, .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION }; - struct device *dev = inst->core->dev_dec; struct v4l2_format format = {}; mutex_lock(&inst->lock); @@ -1310,8 +1357,12 @@ static void vdec_event_change(struct venus_inst *inst, if (inst->bit_depth != ev_data->bit_depth) inst->bit_depth = ev_data->bit_depth; - dev_dbg(dev, "event %s sufficient resources (%ux%u)\n", - sufficient ? "" : "not", ev_data->width, ev_data->height); + VDBGH("event: %s sufficient resources (%ux%u)\n", + sufficient ? "" : "not", ev_data->width, ev_data->height); + + if (ev_data->buf_count) + VDBGH("event: buf_count: %u, old: %u\n", + ev_data->buf_count, inst->num_output_bufs); if (sufficient) { hfi_session_continue(inst); @@ -1344,7 +1395,7 @@ static void vdec_event_change(struct venus_inst *inst, ret = hfi_session_flush(inst, HFI_FLUSH_OUTPUT, false); if (ret) - dev_dbg(dev, "flush output error %d\n", ret); + VDBGH("flush output error (%d)\n", ret); } inst->reconfig = true; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index feed648550d1..c591d00ee0a7 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1074,6 +1074,10 @@ static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type, } v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); + + VDBGH("done: %s, idx: %02u, flen: %08u, flags: hfi: %08x, v4l2: %08x\n", + V4L2_TYPE_IS_OUTPUT(type) ? "out" : "cap", + vbuf->vb2_buf.index, bytesused, hfi_flags, vbuf->flags); } static void venc_event_notify(struct venus_inst *inst, u32 event, From patchwork Sat Jun 13 22:39:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 187919 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1544514ilo; Sat, 13 Jun 2020 15:39:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyihrFvTY1u7JMGrGspylTgVYy449k/sbRIZUKXprKICdgt7/iaXBkHyxlMJdDM/3+ZY2k2 X-Received: by 2002:aa7:d806:: with SMTP id v6mr18320376edq.174.1592087987651; Sat, 13 Jun 2020 15:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592087987; cv=none; d=google.com; s=arc-20160816; b=nfO3HJspSsEieDvvOk6xeiyEffxWKZjR+vKAhPiN0TLcGQ1ozPypynugtEyz8wIujD vqCgDBkDcPHCPkItPIil/lmjSQ7/WIfeGhmMp4C5fTkF3Syq6CW4/zkLZrCvIGRtOKD/ 8cPTduM7/8NjbGVorLLgGnJwdT/3ro6ihvCchI8i94920Psdo0W8SGqnjbL+iBAYbwKo TztsBHVMSYqo9hoP/0RqC2GPoCgv5RL7eIXoyl+azBgDbjdZLvO+FMNyE4wDNrigb/Yu Snb0YTXjHqXeLuZugt5rWiA05PnGkr1P22dgCsUtyRZhKwfn3Z5P3wRm/u5IXTtbckrF JD8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=AUdOHKBSFKpTj40WJgkPwcDzGagUihc/mu7zxNsYZ+k=; b=iDkiHJ6aseRlDauqAWjGhdyreTdNEO9HxuIIKYxF/Ds4skxOjIRBBGq0EwYhDV+iVi +UPQgZ5Yoicn4r+XlAhHRdy/bz+mGisIzyJMcOCPe5GIOyiDRkxTD5yb7uL7Mm47z44C okEoRTgVlT7eTW4DwDAcC1/uN+ftB7PR62A1+hyOGj0WWd5n6/nJBjYRz8kZWwEFe9vm v25NzJdE0dganrl3dyEhZJO4ivKcMZhpE1HHgnBqmJTX0Tf7aST7fRvTqPdCZSw7wbUU F6psAqeFzWx6iIRsHU480bCPdM6I4ZknFmzEicfxiBozPMSv57yYFAxXt8eDaNIYvxEr JJhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OhMh8QdA; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si3663008eja.734.2020.06.13.15.39.47; Sat, 13 Jun 2020 15:39:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=OhMh8QdA; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgFMWjq (ORCPT + 16 others); Sat, 13 Jun 2020 18:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbgFMWjn (ORCPT ); Sat, 13 Jun 2020 18:39:43 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A170C08C5C5 for ; Sat, 13 Jun 2020 15:39:42 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id o15so13585284ejm.12 for ; Sat, 13 Jun 2020 15:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AUdOHKBSFKpTj40WJgkPwcDzGagUihc/mu7zxNsYZ+k=; b=OhMh8QdAKsM/LD7FzRgfTPN/VXAc/bfcsd/Jg+yegVvqkiw0ZQQ1ZFUpO1z6Zg3f3c 3umiBiw5vRmNhJvxwIv2BRS0N6QIiCUm2YkZMvE4edfNg/wTRNBGQ93PnmylKJTlouGd 2G4q2igvurJXoQLCJNFkq1onnfm80LAH68015hanO/XNpStK/wI7ro/50FJCncYabfzE br3OOrcsNlw+g075/h01a9KB12j2L7sQameavQ1HCT4M6rF4/XhSlB9LgjBo0SESuPiw /PvzHHSDjvc2E3cMDocR2Nsl9PGw+veeI72B2UYxioKOz0PfNaJ9DK1OwLr38YvMV92A CiOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AUdOHKBSFKpTj40WJgkPwcDzGagUihc/mu7zxNsYZ+k=; b=gJReqLd5wSyMcOKgSJLGIQOCUXhYyqfLe9HjCB5bOsAB5QxmpOriq8uCOpgS5amK0i VTctRA1/P7M0y/D7/9vVRPGTy/O1iUYtU4i8iROxTWXZPUFDq5nS/+I0YABjN2lN8kFP fZlRH4YXSeQuTg+JFNHMfT8RfC/4mOXhx4B5GoleUc5Y5OwosPyU7U6qJJa5bXA49YIC zoz7L+NBWBiyfnjS2k+g+q+7QknPRdy+qyMjCX/URh16LV+KKfVAZ6zdGMiYdX6AAaib pSd1secq0EXX3sb6ksbAj4+4T2S/U/fQ1yyy3ONi38oFIGyHZXL5g8oEpKF2AdJlVoYE 2snQ== X-Gm-Message-State: AOAM5334E1ASqjvmecmKTSCw6wEwv5wiO0Y0dhrb700YaUlMjycKpg8U JCzybJ8GPC1vqFICxeuZS+z29Q== X-Received: by 2002:a17:906:6d3:: with SMTP id v19mr6626238ejb.306.1592087980907; Sat, 13 Jun 2020 15:39:40 -0700 (PDT) Received: from localhost.localdomain (212-5-158-38.ip.btc-net.bg. [212.5.158.38]) by smtp.gmail.com with ESMTPSA id u3sm5581606edx.25.2020.06.13.15.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 15:39:40 -0700 (PDT) From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Stanimir Varbanov Subject: [PATCH v4 3/3] venus: Add a debugfs file for SSR trigger Date: Sun, 14 Jun 2020 01:39:19 +0300 Message-Id: <20200613223919.7038-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200613223919.7038-1-stanimir.varbanov@linaro.org> References: <20200613223919.7038-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The SSR (SubSystem Restart) is used to simulate an error on FW side of Venus. We support following type of triggers - fatal error, div by zero and watchdog IRQ. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/dbgfs.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/dbgfs.c b/drivers/media/platform/qcom/venus/dbgfs.c index 782d54ac1b8f..f95b7b1febe5 100644 --- a/drivers/media/platform/qcom/venus/dbgfs.c +++ b/drivers/media/platform/qcom/venus/dbgfs.c @@ -9,10 +9,40 @@ extern int venus_fw_debug; +static int trigger_ssr_open(struct inode *inode, struct file *file) +{ + file->private_data = inode->i_private; + return 0; +} + +static ssize_t trigger_ssr_write(struct file *filp, const char __user *buf, + size_t count, loff_t *ppos) +{ + struct venus_core *core = filp->private_data; + u32 ssr_type; + int ret; + + ret = kstrtou32_from_user(buf, count, 4, &ssr_type); + if (ret) + return ret; + + ret = hfi_core_trigger_ssr(core, ssr_type); + if (ret < 0) + return ret; + + return count; +} + +static const struct file_operations ssr_fops = { + .open = trigger_ssr_open, + .write = trigger_ssr_write, +}; + void venus_dbgfs_init(struct venus_core *core) { core->root = debugfs_create_dir("venus", NULL); debugfs_create_x32("fw_level", 0644, core->root, &venus_fw_debug); + debugfs_create_file("trigger_ssr", 0200, core->root, core, &ssr_fops); } void venus_dbgfs_deinit(struct venus_core *core)