Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>
Cc: kpallavi@qti.qualcomm.com, srini@kernel.org,
	amahesh@qti.qualcomm.com,  arnd@arndb.de,
	gregkh@linuxfoundation.org, robh@kernel.org, krzk+dt@kernel.org,
	 conor+dt@kernel.org, quic_bkumar@quicinc.com,
	ekansh.gupta@oss.qualcomm.com,  linux-kernel@vger.kernel.org,
	quic_chennak@quicinc.com, dri-devel@lists.freedesktop.org,
	 linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	jingyi.wang@oss.qualcomm.com,  aiqun.yu@oss.qualcomm.com,
	ktadakam@qti.qualcomm.com
Subject: Re: [PATCH v4 3/4] misc: fastrpc: Add support for new DSP IOVA formatting
Date: Thu, 27 Nov 2025 08:32:34 +0100	[thread overview]
Message-ID: <20251127-liberal-azure-turtle-194a9b@kuoka> (raw)
In-Reply-To: <20251126094545.2139376-4-kumari.pallavi@oss.qualcomm.com>

On Wed, Nov 26, 2025 at 03:15:44PM +0530, Kumari Pallavi wrote:
> @@ -685,7 +701,8 @@ static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
>  		return -ENOMEM;
>  
>  	ret = dma_get_sgtable(buffer->dev, &a->sgt, buffer->virt,
> -			      FASTRPC_PHYS(buffer->dma_addr), buffer->size);
> +			      IPA_TO_DMA_ADDR(buffer->dma_addr,
> +			      buffer->fl->cctx->soc_data->sid_pos), buffer->size);
>  	if (ret < 0) {
>  		dev_err(buffer->dev, "failed to get scatterlist from DMA API\n");
>  		kfree(a);
> @@ -734,7 +751,8 @@ static int fastrpc_mmap(struct dma_buf *dmabuf,
>  	dma_resv_assert_held(dmabuf->resv);
>  
>  	return dma_mmap_coherent(buf->dev, vma, buf->virt,
> -				 FASTRPC_PHYS(buf->dma_addr), size);
> +				 IPA_TO_DMA_ADDR(buf->dma_addr,
> +				 buf->fl->cctx->soc_data->sid_pos), size);

Some odd alignment here. Are you sure you run checkpatch --strict?


>  }
>  
>  static const struct dma_buf_ops fastrpc_dma_buf_ops = {
> @@ -789,7 +807,8 @@ static int fastrpc_map_attach(struct fastrpc_user *fl, int fd,
>  		map->dma_addr = sg_phys(map->table->sgl);
>  	} else {
>  		map->dma_addr = sg_dma_address(map->table->sgl);
> -		map->dma_addr += ((u64)fl->sctx->sid << 32);
> +		map->dma_addr += fastrpc_compute_sid_offset((u64)fl->sctx->sid,
> +				 fl->cctx->soc_data->sid_pos);
>  	}
>  	for_each_sg(map->table->sgl, sgl, map->table->nents,
>  		sgl_index)
> @@ -2290,6 +2309,14 @@ static int fastrpc_get_domain_id(const char *domain)
>  	return -EINVAL;
>  }
>  
> +static const struct fastrpc_soc_data kaanapali_soc_data = {
> +	.sid_pos = 56,
> +};
> +
> +static const struct fastrpc_soc_data default_soc_data = {
> +	.sid_pos = 32,
> +};
> +
>  static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  {
>  	struct device *rdev = &rpdev->dev;
> @@ -2298,6 +2325,11 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  	const char *domain;
>  	bool secure_dsp;
>  	unsigned int vmids[FASTRPC_MAX_VMIDS];
> +	const struct fastrpc_soc_data *soc_data = NULL;

Drop assignment, not helpful.

> +
> +	soc_data = device_get_match_data(rdev);
> +	if (!soc_data)
> +		soc_data = &default_soc_data;
>  
>  	err = of_property_read_string(rdev->of_node, "label", &domain);
>  	if (err) {
> @@ -2350,6 +2382,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  
>  	secure_dsp = !(of_property_read_bool(rdev->of_node, "qcom,non-secure-domain"));
>  	data->secure = secure_dsp;
> +	data->soc_data = soc_data;
>  
>  	switch (domain_id) {
>  	case ADSP_DOMAIN_ID:
> @@ -2487,7 +2520,8 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
>  }
>  
>  static const struct of_device_id fastrpc_rpmsg_of_match[] = {
> -	{ .compatible = "qcom,fastrpc" },
> +	{ .compatible = "qcom,kaanapali-fastrpc", .data = &kaanapali_soc_data },
> +	{ .compatible = "qcom,fastrpc", .data = &default_soc_data },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, fastrpc_rpmsg_of_match);
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-11-27  7:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26  9:45 [PATCH v4 0/4] Add ADSP and CDSP support on Kaanapali SoC Kumari Pallavi
2025-11-26  9:45 ` [PATCH v4 1/4] dt-bindings: misc: qcom,fastrpc: Add compatible for Kaanapali Kumari Pallavi
2025-11-27  7:30   ` Krzysztof Kozlowski
2025-12-01  8:18     ` Kumari Pallavi
2025-12-01  8:36       ` Krzysztof Kozlowski
2025-11-26  9:45 ` [PATCH v4 2/4] misc: fastrpc: Rename phys to dma_addr for clarity Kumari Pallavi
2025-11-27 12:23   ` kernel test robot
2025-11-26  9:45 ` [PATCH v4 3/4] misc: fastrpc: Add support for new DSP IOVA formatting Kumari Pallavi
2025-11-27  7:32   ` Krzysztof Kozlowski [this message]
2025-11-26  9:45 ` [PATCH v4 4/4] misc: fastrpc: Update dma_bits for CDSP support on Kaanapali SoC Kumari Pallavi

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=20251127-liberal-azure-turtle-194a9b@kuoka \
    --to=krzk@kernel.org \
    --cc=aiqun.yu@oss.qualcomm.com \
    --cc=amahesh@qti.qualcomm.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ekansh.gupta@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jingyi.wang@oss.qualcomm.com \
    --cc=kpallavi@qti.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=ktadakam@qti.qualcomm.com \
    --cc=kumari.pallavi@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_bkumar@quicinc.com \
    --cc=quic_chennak@quicinc.com \
    --cc=robh@kernel.org \
    --cc=srini@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