[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251127-liberal-azure-turtle-194a9b@kuoka>
Date: Thu, 27 Nov 2025 08:32:34 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Kumari Pallavi <kumari.pallavi@....qualcomm.com>
Cc: kpallavi@....qualcomm.com, srini@...nel.org, amahesh@....qualcomm.com,
arnd@...db.de, gregkh@...uxfoundation.org, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, quic_bkumar@...cinc.com, ekansh.gupta@....qualcomm.com,
linux-kernel@...r.kernel.org, quic_chennak@...cinc.com, dri-devel@...ts.freedesktop.org,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org, jingyi.wang@....qualcomm.com,
aiqun.yu@....qualcomm.com, ktadakam@....qualcomm.com
Subject: Re: [PATCH v4 3/4] misc: fastrpc: Add support for new DSP IOVA
formatting
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
>
Powered by blists - more mailing lists