Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp422348ybv; Thu, 13 Feb 2020 03:06:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwEgmNH9aqI0BEqi4En/ci6r+4/u1lcMdgag79gAP7OlYebzHlT+bTpIll2wcRsQWtTZmJ1 X-Received: by 2002:a9d:760d:: with SMTP id k13mr12214256otl.42.1581591971914; Thu, 13 Feb 2020 03:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581591971; cv=none; d=google.com; s=arc-20160816; b=A+IkAdlNq5ydARz3DPfP7xQ9epjB+VgFAiN3///jx+n3OUbVU0AvBKCWRNY9LNYCCw ovBF583h6tRxJmIvj5GfOClKs/VlEsTKB43KDlaOW6u9sOdgwcrL5ZfujLsotA5AErdu drmmevKcgV9T6uiySktO/pIPoTyx2gsVHyxisEYvePDebU7c8pd90/ISez7tsDK+RAzT a5adSnNcPakunJFG2mQpNO60n9m872jC4ggBuPKkcEZaS1Uv2iL2MHEkxHDHJnI2nnEY oWecFmz/yS26yvc86rZa/RkVVFvXMaREzyxUQK3rXxcWv1SYf6Ddzz7ozqMAK4qxeeE0 XQiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MBVys1XiEbV3DRgEK21F0Hlq7Y2v2Fx5guJHmJcXIZs=; b=RNswMrT0Bnaky8Akx/a7o6hzRxFPZ09sPdS6LGKu+TPwEMMWX/drBgMOwrbKuOhbUT ZXlG2gn3L6YEUhoCNX+7CDwzF38m+/HQTaapBiBCjQx+g4K6nv4Po3AphUbkdVG1ZJsr PIdk+PXyxQ7zFHVY6HubItoRtEHllbinUcECjzh+7lM6AJ+G9WZnb/P66E+DNPdLF2uA Js/AgFzCmYOO6C4gHbJaoJAXSx/XK6gZmPwwhCMoEexwLPsKksOiubsuf/krUP9hEl81 XtNUue79fqjJNem4bW/i3mvimMjB6vMFMmEKn1yOs4pCsvGg7c7LmIw+qk+VzLB9+EA6 PZDg== ARC-Authentication-Results: i=1; mx.google.com; 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 l80si1018171oib.268.2020.02.13.03.05.58; Thu, 13 Feb 2020 03:06:11 -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; 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 S1729854AbgBMLEX (ORCPT + 99 others); Thu, 13 Feb 2020 06:04:23 -0500 Received: from foss.arm.com ([217.140.110.172]:45006 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729731AbgBMLEX (ORCPT ); Thu, 13 Feb 2020 06:04:23 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ABF381FB; Thu, 13 Feb 2020 03:04:22 -0800 (PST) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3E3233F6CF; Thu, 13 Feb 2020 03:04:21 -0800 (PST) Date: Thu, 13 Feb 2020 11:04:19 +0000 From: Sudeep Holla To: peng.fan@nxp.com Cc: robh+dt@kernel.org, mark.rutland@arm.com, viresh.kumar@linaro.org, f.fainelli@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, andre.przywara@arm.com, Sudeep Holla Subject: Re: [PATCH V2 2/2] firmware: arm_scmi: add smc/hvc transports Message-ID: <20200213110419.GB23374@bogus> References: <1581566330-1029-1-git-send-email-peng.fan@nxp.com> <1581566330-1029-3-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1581566330-1029-3-git-send-email-peng.fan@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 13, 2020 at 11:58:50AM +0800, peng.fan@nxp.com wrote: > From: Peng Fan > > Add SCMI smc/hvc transports support. > > Take smc-id as the 2nd arg, and protocol id as the 2nd arg when > invokding SMC/HVC. Since we need protocol id, so add this parrameter > to chan_setup, then smc transport driver could directly use it. > There is no Rx, only Tx because of smc/hvc not support Rx. > > Signed-off-by: Peng Fan > --- > drivers/firmware/arm_scmi/Makefile | 2 +- > drivers/firmware/arm_scmi/common.h | 4 +- > drivers/firmware/arm_scmi/driver.c | 11 +- > drivers/firmware/arm_scmi/mailbox.c | 2 +- > drivers/firmware/arm_scmi/smc.c | 222 ++++++++++++++++++++++++++++++++++++ > 5 files changed, 234 insertions(+), 7 deletions(-) > create mode 100644 drivers/firmware/arm_scmi/smc.c [...] > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index dbec767222e9..65c56328e6d8 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -595,7 +595,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device *dev, > > cinfo->dev = dev; > > - ret = info->desc->ops->chan_setup(cinfo, info->dev, tx); > + ret = info->desc->ops->chan_setup(cinfo, info->dev, prot_id, tx); Why do you need this ? > if (ret) > return ret; > > @@ -826,7 +829,7 @@ ATTRIBUTE_GROUPS(versions); > > /* Each compatible listed below must have descriptor associated with it */ > static const struct of_device_id scmi_of_match[] = { > - { .compatible = "arm,scmi", .data = &scmi_mailbox_desc }, > + { .compatible = "arm,scmi", }, Don't do this, get "arm,scmi-smc" > { /* Sentinel */ }, > }; > [...] > +static unsigned long > +__invoke_scmi_fn_hvc(unsigned long function_id, unsigned long arg0, > + unsigned long arg1, unsigned long arg2, > + unsigned long arg3, unsigned long arg4, > + unsigned long arg5, unsigned long arg6) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_hvc(function_id, arg0, arg1, arg2, arg3, arg4, arg5, > + arg6, &res); > + > + return res.a0; > +} > + > +static unsigned long > +__invoke_scmi_fn_smc(unsigned long function_id, unsigned long arg0, > + unsigned long arg1, unsigned long arg2, > + unsigned long arg3, unsigned long arg4, > + unsigned long arg5, unsigned long arg6) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_smc(function_id, arg0, arg1, arg2, arg3, arg4, arg5, > + arg6, &res); > + > + return res.a0; > +} > + > +static int scmi_smc_conduit_method(struct device_node *np) > +{ > + const char *method; > + > + if (invoke_scmi_smc_fn) > + return 0; > + > + if (of_property_read_string(np, "method", &method)) > + return -ENXIO; > + > + if (!strcmp("hvc", method)) { > + invoke_scmi_smc_fn = __invoke_scmi_fn_hvc; > + } else if (!strcmp("smc", method)) { > + invoke_scmi_smc_fn = __invoke_scmi_fn_smc; > + } else { > + pr_warn("invalid \"method\" property: %s\n", method); > + return -EINVAL; > + } > + > + return 0; > +} > + You don't the above functions [...] > + > + np = of_find_node_by_path("/psci"); > + if (!np) { > + dev_err(dev, "Not able to find /psci node\n"); > + return -ENODEV; > + } No need for this as mentioned below. > + > + ret = scmi_smc_conduit_method(np); Just use arm_smccc_1_1_get_conduit if you want to get the conduit which I don't think you need. You can just use arm_smccc_1_1_invoke() directly. -- Regards, Sudeep