linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@somainline.org>,
	elder@kernel.org
Cc: bjorn.andersson@linaro.org, agross@kernel.org,
	davem@davemloft.net, kuba@kernel.org,
	linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	konrad.dybcio@somainline.org, marijn.suijten@somainline.org,
	phone-devel@vger.kernel.org
Subject: Re: [PATCH v1 4/7] net: ipa: gsi: Use right masks for GSI v1.0 channels hw param
Date: Wed, 5 May 2021 17:42:52 -0500	[thread overview]
Message-ID: <2b4d50e1-7530-a905-99bc-ce7f4f62344e@ieee.org> (raw)
In-Reply-To: <20210211175015.200772-5-angelogioacchino.delregno@somainline.org>

On 2/11/21 11:50 AM, AngeloGioacchino Del Regno wrote:
> In GSI v1.0 the register GSI_HW_PARAM_2_OFFSET has different layout
> so the number of channels and events per EE are, of course, laid out
> in 8 bits each (0-7, 8-15 respectively).

This is actually wrong.  The fields you are fetching here
define the total number of channels (events) supported by
the IPA hardware, not the number of channels (events) per EE.

The fields we want are in the HW_PARAM_2 register, which
is not present until IPA v3.5.1.

As you did with the FLAVOR_0 register in an earlier patch,
I will update the code so the HW_PARAM_2 register is not
read unless it's defined, and will just skip these validity
checks on the endpoint configuration in that case.  We'll
just assume the hardware supports the maximum number of
channels and endpoints supported by the driver if we don't
know otherwise.

					-Alex

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
>   drivers/net/ipa/gsi.c     | 16 +++++++++++++---
>   drivers/net/ipa/gsi_reg.h |  5 +++++
>   2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
> index b5460cbb085c..3311ffe514c9 100644
> --- a/drivers/net/ipa/gsi.c
> +++ b/drivers/net/ipa/gsi.c
> @@ -1790,7 +1790,7 @@ static void gsi_channel_teardown(struct gsi *gsi)
>   int gsi_setup(struct gsi *gsi)
>   {
>   	struct device *dev = gsi->dev;
> -	u32 val;
> +	u32 val, mask;
>   	int ret;
>   
>   	/* Here is where we first touch the GSI hardware */
> @@ -1804,7 +1804,12 @@ int gsi_setup(struct gsi *gsi)
>   
>   	val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
>   
> -	gsi->channel_count = u32_get_bits(val, NUM_CH_PER_EE_FMASK);
> +	if (gsi->version == IPA_VERSION_3_1)
> +		mask = GSIV1_NUM_CH_PER_EE_FMASK;
> +	else
> +		mask = NUM_CH_PER_EE_FMASK;
> +
> +	gsi->channel_count = u32_get_bits(val, mask);
>   	if (!gsi->channel_count) {
>   		dev_err(dev, "GSI reports zero channels supported\n");
>   		return -EINVAL;
> @@ -1816,7 +1821,12 @@ int gsi_setup(struct gsi *gsi)
>   		gsi->channel_count = GSI_CHANNEL_COUNT_MAX;
>   	}
>   
> -	gsi->evt_ring_count = u32_get_bits(val, NUM_EV_PER_EE_FMASK);
> +	if (gsi->version == IPA_VERSION_3_1)
> +		mask = GSIV1_NUM_EV_PER_EE_FMASK;
> +	else
> +		mask = NUM_EV_PER_EE_FMASK;
> +
> +	gsi->evt_ring_count = u32_get_bits(val, mask);
>   	if (!gsi->evt_ring_count) {
>   		dev_err(dev, "GSI reports zero event rings supported\n");
>   		return -EINVAL;
> diff --git a/drivers/net/ipa/gsi_reg.h b/drivers/net/ipa/gsi_reg.h
> index 0e138bbd8205..4ba579fa21c2 100644
> --- a/drivers/net/ipa/gsi_reg.h
> +++ b/drivers/net/ipa/gsi_reg.h
> @@ -287,6 +287,11 @@ enum gsi_generic_cmd_opcode {
>   			GSI_EE_N_GSI_HW_PARAM_2_OFFSET(GSI_EE_AP)
>   #define GSI_EE_N_GSI_HW_PARAM_2_OFFSET(ee) \
>   			(0x0001f040 + 0x4000 * (ee))
> +
> +/* Fields below are present for IPA v3.1 with GSI version 1 */
> +#define GSIV1_NUM_EV_PER_EE_FMASK	GENMASK(8, 0)
> +#define GSIV1_NUM_CH_PER_EE_FMASK	GENMASK(15, 8)
> +/* Fields below are present for IPA v3.5.1 and above */
>   #define IRAM_SIZE_FMASK			GENMASK(2, 0)
>   #define NUM_CH_PER_EE_FMASK		GENMASK(7, 3)
>   #define NUM_EV_PER_EE_FMASK		GENMASK(12, 8)
> 


  parent reply	other threads:[~2021-05-05 22:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 17:50 [PATCH v1 0/7] Add support for IPA v3.1, GSI v1.0, MSM8998 IPA AngeloGioacchino Del Regno
2021-02-11 17:50 ` [PATCH v1 1/7] net: ipa: Add support for IPA v3.1 with GSI v1.0 AngeloGioacchino Del Regno
2021-02-12 18:49   ` Jakub Kicinski
2021-03-02  2:05   ` Alex Elder
2021-05-05 22:42   ` Alex Elder
2021-02-11 17:50 ` [PATCH v1 2/7] net: ipa: endpoint: Don't read unexistant register on IPAv3.1 AngeloGioacchino Del Regno
2021-03-02  2:05   ` Alex Elder
2021-05-05 22:42   ` Alex Elder
2021-02-11 17:50 ` [PATCH v1 3/7] net: ipa: gsi: Avoid some writes during irq setup for older IPA AngeloGioacchino Del Regno
2021-03-02  2:05   ` Alex Elder
2021-05-05 22:42   ` Alex Elder
2021-02-11 17:50 ` [PATCH v1 4/7] net: ipa: gsi: Use right masks for GSI v1.0 channels hw param AngeloGioacchino Del Regno
2021-03-02  2:05   ` Alex Elder
2021-05-05 22:42   ` Alex Elder [this message]
2021-02-11 17:50 ` [PATCH v1 5/7] net: ipa: Add support for IPA on MSM8998 AngeloGioacchino Del Regno
2021-02-12 18:50   ` Jakub Kicinski
2021-03-02  2:05   ` Alex Elder
2021-05-05 22:42   ` Alex Elder
2021-02-11 17:50 ` [PATCH v1 6/7] dt-bindings: net: qcom-ipa: Document qcom,sc7180-ipa compatible AngeloGioacchino Del Regno
2021-03-02  2:05   ` Alex Elder
2021-03-05 19:32   ` Rob Herring
2021-05-05 22:43   ` Alex Elder
2021-02-11 17:50 ` [PATCH v1 7/7] dt-bindings: net: qcom-ipa: Document qcom,msm8998-ipa compatible AngeloGioacchino Del Regno
2021-03-02  2:05   ` Alex Elder
2021-03-05 19:33   ` Rob Herring
2021-05-05 22:43   ` Alex Elder
2021-02-11 20:27 ` [PATCH v1 0/7] Add support for IPA v3.1, GSI v1.0, MSM8998 IPA Alex Elder
2021-02-11 21:51   ` AngeloGioacchino Del Regno
2021-03-02  2:04 ` Alex Elder
2021-05-05 22:42 ` Alex Elder

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=2b4d50e1-7530-a905-99bc-ce7f4f62344e@ieee.org \
    --to=elder@ieee.org \
    --cc=agross@kernel.org \
    --cc=angelogioacchino.delregno@somainline.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=elder@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=netdev@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    /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).