phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: Sireesh Kodali <sireeshkodali1@gmail.com>,
	phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	elder@kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [RFC PATCH 12/17] net: ipa: Add support for IPA v2.x memory map
Date: Wed, 13 Oct 2021 17:30:26 -0500	[thread overview]
Message-ID: <566b43c9-2893-09ac-1f27-513f0a6d767e@ieee.org> (raw)
In-Reply-To: <20210920030811.57273-13-sireeshkodali1@gmail.com>

On 9/19/21 10:08 PM, Sireesh Kodali wrote:
> IPA v2.6L has an extra region to handle compression/decompression
> acceleration. This region is used by some modems during modem init.

So it has to be initialized?  (I guess so.)

The memory size register apparently doesn't express things in
units of 8 bytes either.

					-Alex

> Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
> ---
>   drivers/net/ipa/ipa_mem.c | 36 ++++++++++++++++++++++++++++++------
>   drivers/net/ipa/ipa_mem.h |  5 ++++-
>   2 files changed, 34 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
> index 8acc88070a6f..bfcdc7e08de2 100644
> --- a/drivers/net/ipa/ipa_mem.c
> +++ b/drivers/net/ipa/ipa_mem.c
> @@ -84,7 +84,7 @@ int ipa_mem_setup(struct ipa *ipa)
>   	/* Get a transaction to define the header memory region and to zero
>   	 * the processing context and modem memory regions.
>   	 */
> -	trans = ipa_cmd_trans_alloc(ipa, 4);
> +	trans = ipa_cmd_trans_alloc(ipa, 5);
>   	if (!trans) {
>   		dev_err(&ipa->pdev->dev, "no transaction for memory setup\n");
>   		return -EBUSY;
> @@ -107,8 +107,14 @@ int ipa_mem_setup(struct ipa *ipa)
>   	ipa_mem_zero_region_add(trans, IPA_MEM_AP_PROC_CTX);
>   	ipa_mem_zero_region_add(trans, IPA_MEM_MODEM);
>   
> +	ipa_mem_zero_region_add(trans, IPA_MEM_ZIP);
> +
>   	ipa_trans_commit_wait(trans);
>   
> +	/* On IPA version <=2.6L (except 2.5) there is no PROC_CTX.  */
> +	if (ipa->version != IPA_VERSION_2_5 && ipa->version <= IPA_VERSION_2_6L)
> +		return 0;
> +
>   	/* Tell the hardware where the processing context area is located */
>   	mem = ipa_mem_find(ipa, IPA_MEM_MODEM_PROC_CTX);
>   	offset = ipa->mem_offset + mem->offset;
> @@ -147,6 +153,11 @@ static bool ipa_mem_id_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
>   	case IPA_MEM_END_MARKER:	/* pseudo region */
>   		break;
>   
> +	case IPA_MEM_ZIP:
> +		if (version == IPA_VERSION_2_6L)
> +			return true;
> +		break;
> +
>   	case IPA_MEM_STATS_TETHERING:
>   	case IPA_MEM_STATS_DROP:
>   		if (version < IPA_VERSION_4_0)
> @@ -319,10 +330,15 @@ int ipa_mem_config(struct ipa *ipa)
>   	/* Check the advertised location and size of the shared memory area */
>   	val = ioread32(ipa->reg_virt + ipa_reg_shared_mem_size_offset(ipa->version));
>   
> -	/* The fields in the register are in 8 byte units */
> -	ipa->mem_offset = 8 * u32_get_bits(val, SHARED_MEM_BADDR_FMASK);
> -	/* Make sure the end is within the region's mapped space */
> -	mem_size = 8 * u32_get_bits(val, SHARED_MEM_SIZE_FMASK);
> +	if (IPA_VERSION_RANGE(ipa->version, 2_0, 2_6L)) {
> +		/* The fields in the register are in 8 byte units */
> +		ipa->mem_offset = 8 * u32_get_bits(val, SHARED_MEM_BADDR_FMASK);
> +		/* Make sure the end is within the region's mapped space */
> +		mem_size = 8 * u32_get_bits(val, SHARED_MEM_SIZE_FMASK);
> +	} else {
> +		ipa->mem_offset = u32_get_bits(val, SHARED_MEM_BADDR_FMASK);
> +		mem_size = u32_get_bits(val, SHARED_MEM_SIZE_FMASK);
> +	}
>   
>   	/* If the sizes don't match, issue a warning */
>   	if (ipa->mem_offset + mem_size < ipa->mem_size) {
> @@ -564,6 +580,10 @@ static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size)
>   		return -EINVAL;
>   	}
>   
> +	/* IPA v2.6L does not use IOMMU */
> +	if (ipa->version <= IPA_VERSION_2_6L)
> +		return 0;
> +
>   	domain = iommu_get_domain_for_dev(dev);
>   	if (!domain) {
>   		dev_err(dev, "no IOMMU domain found for SMEM\n");
> @@ -591,6 +611,9 @@ static void ipa_smem_exit(struct ipa *ipa)
>   	struct device *dev = &ipa->pdev->dev;
>   	struct iommu_domain *domain;
>   
> +	if (ipa->version <= IPA_VERSION_2_6L)
> +		return;
> +
>   	domain = iommu_get_domain_for_dev(dev);
>   	if (domain) {
>   		size_t size;
> @@ -622,7 +645,8 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data)
>   	ipa->mem_count = mem_data->local_count;
>   	ipa->mem = mem_data->local;
>   
> -	ret = dma_set_mask_and_coherent(&ipa->pdev->dev, DMA_BIT_MASK(64));
> +	ret = dma_set_mask_and_coherent(&ipa->pdev->dev, IPA_IS_64BIT(ipa->version) ?
> +					DMA_BIT_MASK(64) : DMA_BIT_MASK(32));
>   	if (ret) {
>   		dev_err(dev, "error %d setting DMA mask\n", ret);
>   		return ret;
> diff --git a/drivers/net/ipa/ipa_mem.h b/drivers/net/ipa/ipa_mem.h
> index 570bfdd99bff..be91cb38b6a8 100644
> --- a/drivers/net/ipa/ipa_mem.h
> +++ b/drivers/net/ipa/ipa_mem.h
> @@ -47,8 +47,10 @@ enum ipa_mem_id {
>   	IPA_MEM_UC_INFO,		/* 0 canaries */
>   	IPA_MEM_V4_FILTER_HASHED,	/* 2 canaries */
>   	IPA_MEM_V4_FILTER,		/* 2 canaries */
> +	IPA_MEM_V4_FILTER_AP,		/* 2 canaries (IPA v2.0) */
>   	IPA_MEM_V6_FILTER_HASHED,	/* 2 canaries */
>   	IPA_MEM_V6_FILTER,		/* 2 canaries */
> +	IPA_MEM_V6_FILTER_AP,		/* 0 canaries (IPA v2.0) */
>   	IPA_MEM_V4_ROUTE_HASHED,	/* 2 canaries */
>   	IPA_MEM_V4_ROUTE,		/* 2 canaries */
>   	IPA_MEM_V6_ROUTE_HASHED,	/* 2 canaries */
> @@ -57,7 +59,8 @@ enum ipa_mem_id {
>   	IPA_MEM_AP_HEADER,		/* 0 canaries, optional */
>   	IPA_MEM_MODEM_PROC_CTX,		/* 2 canaries */
>   	IPA_MEM_AP_PROC_CTX,		/* 0 canaries */
> -	IPA_MEM_MODEM,			/* 0/2 canaries */
> +	IPA_MEM_ZIP,			/* 1 canary (IPA v2.6L) */
> +	IPA_MEM_MODEM,			/* 0-2 canaries */
>   	IPA_MEM_UC_EVENT_RING,		/* 1 canary, optional */
>   	IPA_MEM_PDN_CONFIG,		/* 0/2 canaries (IPA v4.0+) */
>   	IPA_MEM_STATS_QUOTA_MODEM,	/* 2/4 canaries (IPA v4.0+) */
> 


  reply	other threads:[~2021-10-13 22:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  3:07 [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 01/17] net: ipa: Correct ipa_status_opcode enumeration Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:12     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 02/17] net: ipa: revert to IPA_TABLE_ENTRY_SIZE for 32-bit IPA support Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:16     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 04/17] net: ipa: Establish ipa_dma interface Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 16:45     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 05/17] net: ipa: Check interrupts for availability Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 06/17] net: ipa: Add timeout for ipa_cmd_pipeline_clear_wait Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:02     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 07/17] net: ipa: Add IPA v2.x register definitions Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:25     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 08/17] net: ipa: Add support for IPA v2.x interrupts Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 09/17] net: ipa: Add support for using BAM as a DMA transport Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 17:30     ` Sireesh Kodali
2021-09-20  3:08 ` [PATCH 10/17] net: ipa: Add support for IPA v2.x commands and table init Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:13     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 11/17] net: ipa: Add support for IPA v2.x endpoints Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:17     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 12/17] net: ipa: Add support for IPA v2.x memory map Sireesh Kodali
2021-10-13 22:30   ` Alex Elder [this message]
2021-10-18 18:19     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 13/17] net: ipa: Add support for IPA v2.x in the driver's QMI interface Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:22     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 14/17] net: ipa: Add support for IPA v2 microcontroller Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 15/17] net: ipa: Add IPA v2.6L initialization sequence support Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 16/17] net: ipa: Add hw config describing IPA v2.x hardware Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:35     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 17/17] dt-bindings: net: qcom,ipa: Add support for MSM8953 and MSM8996 IPA Sireesh Kodali
2021-09-23 12:42   ` Rob Herring
2021-10-13 22:31   ` Alex Elder
2021-10-13 22:27 ` [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x 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=566b43c9-2893-09ac-1f27-513f0a6d767e@ieee.org \
    --to=elder@ieee.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=sireeshkodali1@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).