Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp206488imu; Mon, 26 Nov 2018 19:44:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/UvpHWraL9O/IhbThVzWxFcOVde09bgMYnlZoJFsgdn2c+HI0TfOxFgVMOUoVw8KOxOkM3d X-Received: by 2002:a63:cf56:: with SMTP id b22mr26187500pgj.336.1543290265256; Mon, 26 Nov 2018 19:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543290265; cv=none; d=google.com; s=arc-20160816; b=XHe4k53HJ+PYPFAheLGqkKr3CwtWiB7lJEakT6pBef0FCz1n+dcsJsUrzDEAn66ERT 646r4+zd4Th+mLbZ6mRtjBJa+FAPGHmX8bGJHVyheTiFWiHPfiJAr5+/4izdmGEEM9/q 5vZDUrtk65LOKGpFVvNWUM7EW0AWhlXBmiAMydufgWSNvNmZ5IecEMxpd8FuvWByA/gi dtDq1ydkg8OqOodGUFDqEG+jU17V2EJqwRKootcEcPy2P6cWqA3+lLIplTmvnuFqbWmD 69P1UQDMGmpHUFvCup0wtR3uqckqjCgJNB4ti5hElPBKJg19Agkm6Rq3qnslELcZYjA2 cwiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=q2RZRe2dsZdUFdh5vIr5N5NQ+rg8gYstHYk9eguALHQ=; b=xFRJPzUsN4HTS3EdQ3vhcRQ3tkrxnMXX+ihyunWyGHO+r7WWL6q3D9K7R2hHZhFHF5 GR6byAN/BDp6YNBbU7pFP3PY9NKs0k/GWOCdnfb4KJA60zzt+V2mCjbYtAd0F+3mRkxC Qgufo5RSKPBWvstrypkcyiZ33tLY7TNAaBrhIDhLVcXRcv+ukisB4H7TiCWqCJeUsgVq Yqieq767CVDQkdkCfxHIQ7Rf+gQ7XJxxE+b2MW3Hs+noXpN0hxAIrj5UQnljMnBquhHv 9OmwgrageUHMFGYT47/UCo3TYDTBTrc1+9i+rd3DTVdWMrwsORrw4hyyJcS2kBWIwzVm b1NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=C6RRNQzi; dkim=pass header.i=@codeaurora.org header.s=default header.b=ABTNcz6h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2595378plo.102.2018.11.26.19.44.10; Mon, 26 Nov 2018 19:44:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=C6RRNQzi; dkim=pass header.i=@codeaurora.org header.s=default header.b=ABTNcz6h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728410AbeK0O2N (ORCPT + 99 others); Tue, 27 Nov 2018 09:28:13 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:38434 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727571AbeK0O2N (ORCPT ); Tue, 27 Nov 2018 09:28:13 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1AAAF607EB; Tue, 27 Nov 2018 03:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543289506; bh=Ub8P+rpiORyQVGCVvQAmPrRzvcRXqXv/cD+tc2JWCVs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=C6RRNQzirzOtSHSMLA+iiZWBg2UX8l8Or7odxesv/MO7T+v4GFrgAqjC0bavAnOiX rTx1H/Pc9S2qRCJ2aOejtJmwS8KKhP9Q7Dkq96ViW5Nkqwqze0VlV96Uusb3zKJrjC 1sC+8gCuTtq+At8JpNNAkWsk4GatRyj10LhvKA2Y= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.79.128.28] (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B7B0F60351; Tue, 27 Nov 2018 03:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543289505; bh=Ub8P+rpiORyQVGCVvQAmPrRzvcRXqXv/cD+tc2JWCVs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ABTNcz6hergajbd59Pr7Nwps/U+A8wTR5KDBsN1GcWMez+EuHuw255Y5OguNAOeUy QSX5y6W2Zo/VEfCJ3PqTHPVWraXyjwGk0PSynpiAfIAv8Po0gOeJ0ChSxomF5ZWEDB 1zif4gPxzlLF7zQwEsuOI/MwiozS9ITzkqG1yt9A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B7B0F60351 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=saiprakash.ranjan@codeaurora.org Subject: Re: [PATCH 3/3] soc: qcom: Add AOSS QMP genpd provider To: Bjorn Andersson , Andy Gross , David Brown Cc: Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181112080557.22698-1-bjorn.andersson@linaro.org> <20181112080557.22698-4-bjorn.andersson@linaro.org> From: Sai Prakash Ranjan Message-ID: Date: Tue, 27 Nov 2018 09:01:40 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181112080557.22698-4-bjorn.andersson@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, On 11/12/2018 1:35 PM, Bjorn Andersson wrote: > The AOSS QMP genpd provider implements control over power-related > resources related to low-power state associated with the remoteprocs in > the system as well as control over a set of clocks related to debug > hardware in the SoC. > > Signed-off-by: Bjorn Andersson > --- > drivers/soc/qcom/Kconfig | 8 ++ > drivers/soc/qcom/Makefile | 1 + > drivers/soc/qcom/aoss-qmp-pd.c | 135 +++++++++++++++++++++++++++++++++ > 3 files changed, 144 insertions(+) > create mode 100644 drivers/soc/qcom/aoss-qmp-pd.c > > diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig > index ba08fc00d7f5..e1eda3d59748 100644 > --- a/drivers/soc/qcom/Kconfig > +++ b/drivers/soc/qcom/Kconfig > @@ -10,6 +10,14 @@ config QCOM_AOSS_QMP > micro-controller in the AOSS, using QMP, to control certain resource > that are not exposed through RPMh. > > +config QCOM_AOSS_QMP_PD > + tristate "Qualcomm AOSS Messaging Power Domain driver" > + depends on QCOM_AOSS_QMP > + help > + This driver provides the means of controlling the AOSSs handling of > + low-power state for resources related to the remoteproc subsystems as > + well as controlling the debug clocks. > + > config QCOM_COMMAND_DB > bool "Qualcomm Command DB" > depends on ARCH_QCOM || COMPILE_TEST > diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile > index d0d7fdc94d9a..ebfa414a5b77 100644 > --- a/drivers/soc/qcom/Makefile > +++ b/drivers/soc/qcom/Makefile > @@ -1,6 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > CFLAGS_rpmh-rsc.o := -I$(src) > obj-$(CONFIG_QCOM_AOSS_QMP) += aoss-qmp.o > +obj-$(CONFIG_QCOM_AOSS_QMP_PD) += aoss-qmp-pd.o > obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o > obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o > obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o > diff --git a/drivers/soc/qcom/aoss-qmp-pd.c b/drivers/soc/qcom/aoss-qmp-pd.c > new file mode 100644 > index 000000000000..467d0db4abfa > --- /dev/null > +++ b/drivers/soc/qcom/aoss-qmp-pd.c > @@ -0,0 +1,135 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2018, Linaro Ltd > + */ > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +struct qmp_pd { > + struct qmp *qmp; > + > + struct generic_pm_domain pd; > + > + const char *name; > +}; > + > +#define to_qmp_pd_resource(res) container_of(res, struct qmp_pd, pd) > + > +struct qmp_pd_resource { > + const char *name; > + int (*on)(struct generic_pm_domain *domain); > + int (*off)(struct generic_pm_domain *domain); > +}; > + > +static int qmp_pd_clock_toggle(struct qmp_pd *res, bool enable) > +{ > + char buf[96]; > + size_t n; > + > + n = snprintf(buf, sizeof(buf), "{class: clock, res: %s, val: %d}", > + res->name, !!enable); > + return qmp_send(res->qmp, buf, n); > +} > + I was trying to get QDSS working with these patches and found one issue in qmp_send of qmp_pd_clock_toggle. The third return value should be sizeof(buf) instead of n because n just returns len as 33 and the below check in qmp send will always fail and trigger WARN_ON's. if (WARN_ON(len % sizeof(u32))) { dev_err(qmp->dev, "message not 32-bit aligned\n"); return -EINVAL; } Also I observed that multiple "ucore will not ack channel" messages with len being returned n instead of buf size. One more thing is do we really require *WARN_ON and dev_err* both because it just spams the kernel logs, I think dev_err message is clear enough to be able to understand the error condition. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation