Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5182906pxv; Tue, 20 Jul 2021 22:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHXBC0lfASwkRCwTlKlGpjhjjIkdrfwzOFYQNLt42l4bcDzkmTKURMPSOUaWMj0UXfOXXx X-Received: by 2002:a5e:db02:: with SMTP id q2mr20518687iop.172.1626845243583; Tue, 20 Jul 2021 22:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626845243; cv=none; d=google.com; s=arc-20160816; b=zW6YNhNUItoIR+RCQHu/7U0erC4eavPdwDO7IA91AP4c32nX8zpcNC20tPZGwnfuMJ Rp6wocra2S9lgDQfDIK8ZN433isCqUcCs67SdvMINyGAEPi1Jb+wIDjcBMRDwDJ1MqQx bAMe8EDZx9e7gIb5h3J1yoqb8wWL60/un7lw7yLuQ9TTdQg/R6RUVH1m44wjrfdV0LE3 KfnXsQ+WXKVjspzhHUimjANTkGucLGBSQaNjsqyXNKHK5nqYAO463OLal1ST1d+9GZg5 KV+b8TSd70EJksgLTyo+SxE9uzUTlFbtiQECw/VO/6dijl5RqnqM5obfRS1tIM6hwLrX 6JMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=2vZaK5rMHWTEBuE5R0Hk93f1smaSD/eyQxjWnxs8hMM=; b=ALeh2d1gOR2NJIrX2TnfHnVl3N0NPvTKSKYJFnpIdtSSpjolwmRbo5mmCDGunJjN75 2v85vVqQEuIGsOYqYje2gSAHXwpJwTLNfC4KJxQfBS0iFxwuHedoQ32sm7H3eM9rK8Dy 8XhfQ7kQyvESwSn+6DAkvhgK3DI/2AsqRG29Ckou2ccrDmeuZYItqgywZiiWkRKGs+8h kHHcCt6V/2pWK01slo6YlAZ+KV8KW+UuIYfE7kqsnGZmZHB5bW6OvDYO9V7jLbu0zxWC jFDEs2WGQKoP0ZA85Zxsf5qiPFwwx/eMSQGHhKaMP6pOfdArI1FI/tqAxBxmAS0X2Yoa Sgbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mB0KXile; 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 f15si16608418iox.8.2021.07.20.22.27.12; Tue, 20 Jul 2021 22:27:23 -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=mB0KXile; 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 S232940AbhGUEpr (ORCPT + 99 others); Wed, 21 Jul 2021 00:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbhGUEpq (ORCPT ); Wed, 21 Jul 2021 00:45:46 -0400 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06ED6C061762 for ; Tue, 20 Jul 2021 22:26:20 -0700 (PDT) Received: by mail-oo1-xc34.google.com with SMTP id s11-20020a4ae48b0000b02902667598672bso303343oov.12 for ; Tue, 20 Jul 2021 22:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=2vZaK5rMHWTEBuE5R0Hk93f1smaSD/eyQxjWnxs8hMM=; b=mB0KXileUD1bpLEzFnlL4ZOS1gzZIi9lnYLV3XD2OaHTr3ABwOuN1Rp7c37bBUrH9L A6aoxW6rH6/r1Cwxj38C31Gp73mSFOoqNTyAxLHBVFmkl4v/x0pC52wgYeiXcxnW4pQX oetAETTHWWGAf4zjgx/70qFLkHEgwOUEKIB84= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=2vZaK5rMHWTEBuE5R0Hk93f1smaSD/eyQxjWnxs8hMM=; b=fE8cNk39/QL7zLp4WExojq3eS/ZDxNpduhavGqKpriQZ8msnBt3mvDCM1HfdbEV/UR /WFSt29ukZjV+QMoNe8l0wFQTGw8qaMTCYoiWDwZu/n+lIpvyd8pSQZEQ7+r+/Enolq0 be+3ToVr5t5V4cQZBTA9VCKWQZq1KW+HlsNi+LVIZXQyRxYwtdGdDfgGWhMvHmd3+SdG 85S77XoSpEnRwqxWhahn8v8Rkda/TgpMGdMQqRQQkO+9voLKIZoEFeB1mPLx0yAwRyXc MUMUqh5wceLORuMOhpJvzoU0xy5SFdJ6AopIizqbcBlR9/Vts2t4jeTmojeMwDAGwSYA fw4g== X-Gm-Message-State: AOAM532L0BpRmb0m+TkkWMPDX9nBmJ0B7W/VgpaIz/yNvPVhbqsryCop 6O0rqpgk76AIhdrf7wfE1wJax95Cga2Rbld2QFzGnw== X-Received: by 2002:a4a:a6c2:: with SMTP id i2mr17450621oom.92.1626845179395; Tue, 20 Jul 2021 22:26:19 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 21 Jul 2021 05:26:19 +0000 MIME-Version: 1.0 In-Reply-To: <1626755807-11865-5-git-send-email-sibis@codeaurora.org> References: <1626755807-11865-1-git-send-email-sibis@codeaurora.org> <1626755807-11865-5-git-send-email-sibis@codeaurora.org> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Wed, 21 Jul 2021 05:26:19 +0000 Message-ID: Subject: Re: [PATCH v4 04/13] remoteproc: qcom: q6v5: Use qmp_send to update co-processor load state To: Sibi Sankar , bjorn.andersson@linaro.org, mka@chromium.org, robh+dt@kernel.org Cc: ulf.hansson@linaro.org, rjw@rjwysocki.net, agross@kernel.org, ohad@wizery.com, mathieu.poirier@linaro.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, rishabhb@codeaurora.org, sidgup@codeaurora.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Sibi Sankar (2021-07-19 21:36:38) > diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c > index 7e9244c748da..997ff21271f7 100644 > --- a/drivers/remoteproc/qcom_q6v5.c > +++ b/drivers/remoteproc/qcom_q6v5.c > @@ -16,8 +16,28 @@ > #include "qcom_common.h" > #include "qcom_q6v5.h" > > +#define Q6V5_LOAD_STATE_MSG_LEN 64 > #define Q6V5_PANIC_DELAY_MS 200 > > +static int q6v5_load_state_toggle(struct qcom_q6v5 *q6v5, bool enable) > +{ > + char buf[Q6V5_LOAD_STATE_MSG_LEN] = {}; Just to confirm, we want to set the whole buffer to zero before writing it? Sounds good to not send stack junk over to to the other side but maybe we could skip initializing to zero for the first part of the buffer that isn't used? > + int ret; > + > + if (IS_ERR(q6v5->qmp)) > + return 0; > + > + snprintf(buf, sizeof(buf), > + "{class: image, res: load_state, name: %s, val: %s}", > + q6v5->load_state, enable ? "on" : "off"); Should we WARN_ON() if the message doesn't fit into the 64-bytes? > + > + ret = qmp_send(q6v5->qmp, buf, sizeof(buf)); > + if (ret) > + dev_err(q6v5->dev, "failed to toggle load state\n"); > + > + return ret; > +} > + > /** > * qcom_q6v5_prepare() - reinitialize the qcom_q6v5 context before start > * @q6v5: reference to qcom_q6v5 context to be reinitialized > @@ -196,12 +223,13 @@ EXPORT_SYMBOL_GPL(qcom_q6v5_panic); > * @pdev: platform_device reference for acquiring resources > * @rproc: associated remoteproc instance > * @crash_reason: SMEM id for crash reason string, or 0 if none > + * @load_state: load state resource string > * @handover: function to be called when proxy resources should be released > * > * Return: 0 on success, negative errno on failure > */ > int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev, > - struct rproc *rproc, int crash_reason, > + struct rproc *rproc, int crash_reason, const char *load_state, > void (*handover)(struct qcom_q6v5 *q6v5)) > { > int ret; > @@ -286,9 +314,36 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev, > return PTR_ERR(q6v5->state); > } > > + q6v5->load_state = kstrdup_const(load_state, GFP_KERNEL); > + q6v5->qmp = qmp_get(&pdev->dev); > + if (IS_ERR(q6v5->qmp)) { > + if (PTR_ERR(q6v5->qmp) != -ENODEV) { > + if (PTR_ERR(q6v5->qmp) != -EPROBE_DEFER) > + dev_err(&pdev->dev, "failed to acquire load state\n"); Use dev_err_probe()? > + kfree_const(q6v5->load_state); > + return PTR_ERR(q6v5->qmp); > + } > + } else { > + if (!q6v5->load_state) { Use else if and deindent? > + dev_err(&pdev->dev, "load state resource string empty\n"); > + return -EINVAL; > + } > + } > + > return 0; > } > EXPORT_SYMBOL_GPL(qcom_q6v5_init); >