mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>,
	Amol Maheshwari <amahesh@qti.qualcomm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: aiqun.yu@oss.qualcomm.com, tingwei.zhang@oss.qualcomm.com,
	trilok.soni@oss.qualcomm.com, yijie.yang@oss.qualcomm.com,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Jingyi Wang <jingyi.wang@oss.qualcomm.com>,
	Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>
Subject: [PATCH 2/2] misc: fastrpc: Update dma_mask for CDSP support on Kaanapali SoC
Date: Wed, 24 Sep 2025 16:46:37 -0700	[thread overview]
Message-ID: <20250924-knp-fastrpc-v1-2-4b40f8bfce1d@oss.qualcomm.com> (raw)
In-Reply-To: <20250924-knp-fastrpc-v1-0-4b40f8bfce1d@oss.qualcomm.com>

From: Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>

DSP currently supports 32-bit IOVA (32-bit PA + 4-bit SID) for
both Q6 and user DMA (uDMA) access. This is being upgraded to
34-bit PA + 4-bit SID due to a hardware revision in CDSP for
Kaanapali SoC, which expands the DMA addressable range.
Update DMA mask configuration in the driver to support CDSP on
Kaanapali SoC. Set the default `dma_mask` to 32-bit and update
it to 34-bit based on CDSP and SoC-specific compatible string.

Signed-off-by: Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>
Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
---
 drivers/misc/fastrpc.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index db396241b8ce..e019163eb265 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -275,6 +275,7 @@ struct fastrpc_session_ctx {
 	bool used;
 	bool valid;
 	u32 sid_pos;
+	u32 pa_bits;
 };
 
 struct fastrpc_channel_ctx {
@@ -2179,9 +2180,9 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
 	sess->used = false;
 	sess->valid = true;
 	sess->dev = dev;
+	sess->pa_bits = cctx->dma_mask;
 	/* Configure where sid will be prepended to pa */
-	sess->sid_pos =
-		(cctx->iova_format ? SID_POS_IN_IOVA : DSP_DEFAULT_BUS_WIDTH);
+	sess->sid_pos = (cctx->iova_format ? SID_POS_IN_IOVA : sess->pa_bits);
 
 	if (of_property_read_u32(dev->of_node, "reg", &sess->sid))
 		dev_info(dev, "FastRPC Session ID not specified in DT\n");
@@ -2198,9 +2199,9 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
 		}
 	}
 	spin_unlock_irqrestore(&cctx->lock, flags);
-	rc = dma_set_mask(dev, DMA_BIT_MASK(32));
+	rc = dma_set_mask(dev, DMA_BIT_MASK(sess->pa_bits));
 	if (rc) {
-		dev_err(dev, "32-bit DMA enable failed\n");
+		dev_err(dev, "%u-bit DMA enable failed\n", sess->pa_bits);
 		return rc;
 	}
 
@@ -2287,10 +2288,12 @@ static int fastrpc_get_domain_id(const char *domain)
 
 struct fastrpc_soc_data {
 	u32 dsp_iova_format;
+	u32 cdsp_dma_mask;
 };
 
 static const struct fastrpc_soc_data kaanapali_soc_data = {
 	.dsp_iova_format = 1,
+	.cdsp_dma_mask = 34,
 };
 
 static const struct of_device_id qcom_soc_match_table[] = {
@@ -2310,6 +2313,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
 	const struct of_device_id *match;
 	const struct fastrpc_soc_data *soc_data = NULL;
 	u32 iova_format = 0;
+	u32 ubs = DSP_DEFAULT_BUS_WIDTH;
 
 	root = of_find_node_by_path("/");
 	if (!root)
@@ -2322,6 +2326,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
 	} else {
 		soc_data = match->data;
 		iova_format = soc_data->dsp_iova_format;
+		ubs = soc_data->cdsp_dma_mask;
 	}
 
 	err = of_property_read_string(rdev->of_node, "label", &domain);
@@ -2404,6 +2409,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
 	}
 	/* determine where sid needs to be prepended to pa based on iova_format */
 	data->iova_format = iova_format;
+	data->dma_mask = (domain_id == CDSP_DOMAIN_ID ? ubs : DSP_DEFAULT_BUS_WIDTH);
 	kref_init(&data->refcount);
 
 	dev_set_drvdata(&rpdev->dev, data);

-- 
2.25.1


  parent reply	other threads:[~2025-09-24 23:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 23:46 [PATCH 0/2] Add ADSP and " Jingyi Wang
2025-09-24 23:46 ` [PATCH 1/2] misc: fastrpc: Add support for new DSP IOVA formatting Jingyi Wang
2025-09-25  2:25   ` Dmitry Baryshkov
2025-09-30  4:43     ` Kumari Pallavi
2025-09-25  6:24   ` Arnd Bergmann
2025-09-30  4:40     ` Kumari Pallavi
2025-09-26  0:08   ` kernel test robot
2025-10-04 18:25   ` Srinivas Kandagatla
2025-09-24 23:46 ` Jingyi Wang [this message]
2025-09-25  2:57   ` [PATCH 2/2] misc: fastrpc: Update dma_mask for CDSP support on Kaanapali SoC Dmitry Baryshkov
2025-10-04 18:36   ` Srinivas Kandagatla

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=20250924-knp-fastrpc-v1-2-4b40f8bfce1d@oss.qualcomm.com \
    --to=jingyi.wang@oss.qualcomm.com \
    --cc=aiqun.yu@oss.qualcomm.com \
    --cc=amahesh@qti.qualcomm.com \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kumari.pallavi@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srini@kernel.org \
    --cc=tingwei.zhang@oss.qualcomm.com \
    --cc=trilok.soni@oss.qualcomm.com \
    --cc=yijie.yang@oss.qualcomm.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

all inboxes | Powered by JetHome®