linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: Sudeep Holla <sudeep.holla@arm.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Cc: "aidapala@qti.qualcomm.com" <aidapala@qti.qualcomm.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Souvik Chakravarty <Souvik.Chakravarty@arm.com>,
	"wesleys@xilinx.com" <wesleys@xilinx.com>,
	Ionela Voinescu <Ionela.Voinescu@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Saeed Nowshadi <saeed.nowshadi@xilinx.com>,
	Quentin Perret <Quentin.Perret@arm.com>,
	Bo Zhang <bozhang.zhang@broadcom.com>,
	Felix Burton <fburton@xilinx.com>,
	Jim Quinlan <james.quinlan@broadcom.com>,
	Chris Redpath <Chris.Redpath@arm.com>,
	"pajay@qti.qualcomm.com" <pajay@qti.qualcomm.com>,
	Gaku Inami <gaku.inami.xh@renesas.com>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH v2 2/5] firmware: arm_scmi: Make use SCMI v2.0 fastchannel for performance protocol
Date: Wed, 7 Aug 2019 10:01:54 +0000	[thread overview]
Message-ID: <AM0PR04MB4481C5CCF8DD27E92902135C88D40@AM0PR04MB4481.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20190806170208.6787-3-sudeep.holla@arm.com>

> Subject: [PATCH v2 2/5] firmware: arm_scmi: Make use SCMI v2.0
> fastchannel for performance protocol
> 
> SCMI v2.0 adds support for "FastChannel" which do not use a message
> header as they are specialized for a single message.
> 
> Only PERFORMANCE_LIMITS_{SET,GET} and
> PERFORMANCE_LEVEL_{SET,GET} commands are supported over
> fastchannels. As they are optional, they need to be discovered by
> PERFORMANCE_DESCRIBE_FASTCHANNEL command.
> Further {LIMIT,LEVEL}_SET commands can have optional doorbell support.
> 
> Add support for making use of these fastchannels.
> 
> Cc: Ionela Voinescu <Ionela.Voinescu@arm.com>
> Cc: Chris Redpath <Chris.Redpath@arm.com>
> Cc: Quentin Perret <Quentin.Perret@arm.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/perf.c | 104
> +++++++++++++++++++++++++++++--
>  1 file changed, 100 insertions(+), 4 deletions(-)
> 
> v1->v2:
> 	- Changed the macro SCMI_PERF_FC_RING_DB to use do {} while(0)
> 
> diff --git a/drivers/firmware/arm_scmi/perf.c
> b/drivers/firmware/arm_scmi/perf.c
> index 6cce3e82e81e..fb7f6cab2c11 100644
> --- a/drivers/firmware/arm_scmi/perf.c
> +++ b/drivers/firmware/arm_scmi/perf.c
> @@ -8,6 +8,7 @@
>  #include <linux/bits.h>
>  #include <linux/of.h>
>  #include <linux/io.h>
> +#include <linux/io-64-nonatomic-hi-lo.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_opp.h>
>  #include <linux/sort.h>
> @@ -293,7 +294,42 @@ scmi_perf_describe_levels_get(const struct
> scmi_handle *handle, u32 domain,
>  	return ret;
>  }
> 
> -static int scmi_perf_limits_set(const struct scmi_handle *handle, u32
> domain,
> +#define SCMI_PERF_FC_RING_DB(doorbell, w)		\
> +do {							\
> +	u##w val = 0;					\
> +	struct scmi_fc_db_info *db = doorbell;		\
> +							\
> +	if (db->mask)					\
> +		val = ioread##w(db->addr) & db->mask;	\
> +	iowrite##w((u##w)db->set | val, db->addr);	\
> +} while(0)
> +
> +static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db) {
> +	if (!db || !db->addr)
> +		return;
> +
> +	if (db->width == 1)
> +		SCMI_PERF_FC_RING_DB(db, 8);
> +	else if (db->width == 2)
> +		SCMI_PERF_FC_RING_DB(db, 16);
> +	else if (db->width == 4)
> +		SCMI_PERF_FC_RING_DB(db, 32);
> +	else /* db->width == 8 */
> +#ifdef CONFIG_64BIT
> +		SCMI_PERF_FC_RING_DB(db, 64);
> +#else
> +	{
> +		u64 val = 0;
> +
> +		if (db->mask)
> +			val = ioread64_hi_lo(db->addr) & db->mask;
> +		iowrite64_hi_lo(db->set, db->addr);
> +	}
> +#endif
> +}
> +
> +static int scmi_perf_mb_limits_set(const struct scmi_handle *handle,
> +u32 domain,
>  				   u32 max_perf, u32 min_perf)
>  {
>  	int ret;
> @@ -316,7 +352,23 @@ static int scmi_perf_limits_set(const struct
> scmi_handle *handle, u32 domain,
>  	return ret;
>  }
> 
> -static int scmi_perf_limits_get(const struct scmi_handle *handle, u32
> domain,
> +static int scmi_perf_limits_set(const struct scmi_handle *handle, u32
> domain,
> +				u32 max_perf, u32 min_perf)
> +{
> +	struct scmi_perf_info *pi = handle->perf_priv;
> +	struct perf_dom_info *dom = pi->dom_info + domain;
> +
> +	if (dom->fc_info && dom->fc_info->limit_set_addr) {
> +		iowrite32(max_perf, dom->fc_info->limit_set_addr);
> +		iowrite32(min_perf, dom->fc_info->limit_set_addr + 4);
> +		scmi_perf_fc_ring_db(dom->fc_info->limit_set_db);
> +		return 0;
> +	}
> +
> +	return scmi_perf_mb_limits_set(handle, domain, max_perf, min_perf); }
> +
> +static int scmi_perf_mb_limits_get(const struct scmi_handle *handle,
> +u32 domain,
>  				   u32 *max_perf, u32 *min_perf)
>  {
>  	int ret;
> @@ -342,7 +394,22 @@ static int scmi_perf_limits_get(const struct
> scmi_handle *handle, u32 domain,
>  	return ret;
>  }
> 
> -static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain,
> +static int scmi_perf_limits_get(const struct scmi_handle *handle, u32
> domain,
> +				u32 *max_perf, u32 *min_perf)
> +{
> +	struct scmi_perf_info *pi = handle->perf_priv;
> +	struct perf_dom_info *dom = pi->dom_info + domain;
> +
> +	if (dom->fc_info && dom->fc_info->limit_get_addr) {
> +		*max_perf = ioread32(dom->fc_info->limit_get_addr);
> +		*min_perf = ioread32(dom->fc_info->limit_get_addr + 4);
> +		return 0;
> +	}
> +
> +	return scmi_perf_mb_limits_get(handle, domain, max_perf, min_perf); }
> +
> +static int scmi_perf_mb_level_set(const struct scmi_handle *handle, u32
> +domain,
>  				  u32 level, bool poll)
>  {
>  	int ret;
> @@ -365,7 +432,22 @@ static int scmi_perf_level_set(const struct
> scmi_handle *handle, u32 domain,
>  	return ret;
>  }
> 
> -static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain,
> +static int scmi_perf_level_set(const struct scmi_handle *handle, u32
> domain,
> +			       u32 level, bool poll)
> +{
> +	struct scmi_perf_info *pi = handle->perf_priv;
> +	struct perf_dom_info *dom = pi->dom_info + domain;
> +
> +	if (dom->fc_info && dom->fc_info->level_set_addr) {
> +		iowrite32(level, dom->fc_info->level_set_addr);
> +		scmi_perf_fc_ring_db(dom->fc_info->level_set_db);
> +		return 0;
> +	}
> +
> +	return scmi_perf_mb_level_set(handle, domain, level, poll); }
> +
> +static int scmi_perf_mb_level_get(const struct scmi_handle *handle, u32
> +domain,
>  				  u32 *level, bool poll)
>  {
>  	int ret;
> @@ -387,6 +469,20 @@ static int scmi_perf_level_get(const struct
> scmi_handle *handle, u32 domain,
>  	return ret;
>  }
> 
> +static int scmi_perf_level_get(const struct scmi_handle *handle, u32
> domain,
> +			       u32 *level, bool poll)
> +{
> +	struct scmi_perf_info *pi = handle->perf_priv;
> +	struct perf_dom_info *dom = pi->dom_info + domain;
> +
> +	if (dom->fc_info && dom->fc_info->level_get_addr) {
> +		*level = ioread32(dom->fc_info->level_get_addr);
> +		return 0;
> +	}
> +
> +	return scmi_perf_mb_level_get(handle, domain, level, poll); }
> +
>  static bool scmi_perf_fc_size_is_valid(u32 msg, u32 size)  {
>  	if ((msg == PERF_LEVEL_GET || msg == PERF_LEVEL_SET) && size == 4)

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-07 10:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 17:02 [PATCH v2 0/5] firmware: arm_scmi: add SCMI v2.0 fastchannels and reset protocol support Sudeep Holla
2019-08-06 17:02 ` [PATCH v2 1/5] firmware: arm_scmi: Add discovery of SCMI v2.0 performance fastchannels Sudeep Holla
2019-08-07  9:23   ` Peng Fan
2019-08-07 10:28     ` Sudeep Holla
2019-08-06 17:02 ` [PATCH v2 2/5] firmware: arm_scmi: Make use SCMI v2.0 fastchannel for performance protocol Sudeep Holla
2019-08-07 10:01   ` Peng Fan [this message]
2019-08-06 17:02 ` [PATCH v2 3/5] dt-bindings: arm: Extend SCMI to support new reset protocol Sudeep Holla
2019-08-07  8:26   ` Philipp Zabel
2019-08-07 10:18     ` Sudeep Holla
2019-08-07 17:41   ` Sudeep Holla
2019-08-06 17:02 ` [PATCH v2 4/5] firmware: arm_scmi: Add RESET protocol in SCMI v2.0 Sudeep Holla
2019-08-07  8:17   ` Philipp Zabel
2019-08-07 10:35     ` Sudeep Holla
2019-08-07 10:07   ` Peng Fan
2019-08-06 17:02 ` [PATCH v2 5/5] reset: Add support for resets provided by SCMI Sudeep Holla
2019-08-07  8:04   ` Philipp Zabel
2019-08-07 10:31     ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR04MB4481C5CCF8DD27E92902135C88D40@AM0PR04MB4481.eurprd04.prod.outlook.com \
    --to=peng.fan@nxp.com \
    --cc=Chris.Redpath@arm.com \
    --cc=Ionela.Voinescu@arm.com \
    --cc=Quentin.Perret@arm.com \
    --cc=Souvik.Chakravarty@arm.com \
    --cc=aidapala@qti.qualcomm.com \
    --cc=bozhang.zhang@broadcom.com \
    --cc=etienne.carriere@linaro.org \
    --cc=fburton@xilinx.com \
    --cc=gaku.inami.xh@renesas.com \
    --cc=james.quinlan@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pajay@qti.qualcomm.com \
    --cc=saeed.nowshadi@xilinx.com \
    --cc=sudeep.holla@arm.com \
    --cc=volodymyr_babchuk@epam.com \
    --cc=wesleys@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).