From: "Arnd Bergmann" <arnd@arndb.de>
To: "Kumari Pallavi" <kumari.pallavi@oss.qualcomm.com>,
kpallavi@qti.qualcomm.com,
"Srinivas Kandagatla" <srini@kernel.org>,
"Amol Maheshwari" <amahesh@qti.qualcomm.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: 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,
"Jingyi Wang" <jingyi.wang@oss.qualcomm.com>,
aiqun.yu@oss.qualcomm.com, ktadakam@qti.qualcomm.com
Subject: Re: [PATCH v2 1/3] misc: fastrpc: Rename phys to dma_addr for clarity
Date: Wed, 15 Oct 2025 09:20:05 +0200 [thread overview]
Message-ID: <2e571b41-0006-4a37-9e3b-d333bf5eb7ed@app.fastmail.com> (raw)
In-Reply-To: <20251015045702.3022060-2-kumari.pallavi@oss.qualcomm.com>
On Wed, Oct 15, 2025, at 06:57, Kumari Pallavi wrote:
> Update all references of buf->phys and map->phys to buf->dma_addr and
> map->dma_addr to accurately represent that these fields store DMA
> addresses, not physical addresses. This change improves code clarity
> and aligns with kernel conventions for dma_addr_t usage.
>
> Signed-off-by: Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>
Thanks for the update!
> &src_perms, &perm, 1);
> if (err) {
> - dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx
> size 0x%llx err %d\n",
> - map->phys, map->len, err);
> + dev_err(map->fl->sctx->dev, "Failed to assign memory dma_addr
> 0x%llx size 0x%llx err %d\n",
> + map->dma_addr, map->len, err);
> return;
Note that using %llx is not a portable way to print a dma_addr_t,
you should use %pad instead even if your method works on all
arm64 configurations.
%pad requires passing the dma_addr_t variable by reference though.
> @@ -783,10 +783,10 @@ static int fastrpc_map_attach(struct fastrpc_user
> *fl, int fd,
> map->table = table;
>
> if (attr & FASTRPC_ATTR_SECUREMAP) {
> - map->phys = sg_phys(map->table->sgl);
> + map->dma_addr = sg_phys(map->table->sgl);
> } else {
This is technically still wrong, because sg_phys() returns
a phys_addr_t that is only the same as the dma_addr_t value
if there is no iommu or dma offset.
At the minimum, this requires a comment explaining what you
are doing here, and I would add a '(dma_addr_t)' cast as
well.
If possible, use sg_dma_address() instead of sg_phys() for
portability if they produce the same bit value.
> @@ -813,10 +813,10 @@ static int fastrpc_map_attach(struct fastrpc_user
> *fl, int fd,
> dst_perms[1].vmid = fl->cctx->vmperms[0].vmid;
> dst_perms[1].perm = QCOM_SCM_PERM_RWX;
> map->attr = attr;
> - err = qcom_scm_assign_mem(map->phys, (u64)map->len, &src_perms,
> dst_perms, 2);
> + err = qcom_scm_assign_mem(map->dma_addr, (u64)map->len, &src_perms,
This one has the reverse problem, as qcom_scm_assign_mem() takes
a phys_addr_t instead of a dma_addr_t, again relying on the
absence of an iommu.
> dst_perms, 2);
> if (err) {
> - dev_err(sess->dev, "Failed to assign memory with phys 0x%llx size
> 0x%llx err %d\n",
> - map->phys, map->len, err);
> + dev_err(sess->dev, "Failed to assign memory with dma_addr 0x%llx
> size 0x%llx err %d\n",
> + map->dma_addr, map->len, err);
> goto map_err;
%pad
> }
> }
> @@ -1007,7 +1007,7 @@ static int fastrpc_get_args(u32 kernel, struct
> fastrpc_invoke_ctx *ctx)
> struct vm_area_struct *vma = NULL;
>
> rpra[i].buf.pv = (u64) ctx->args[i].ptr;
> - pages[i].addr = ctx->maps[i]->phys;
> + pages[i].addr = ctx->maps[i]->dma_addr;
>
pages[i].addr is declared as
"u64 addr; /* physical address */"
I guess the other side of this is the same CPU in a different
exception level instead of an external device, right? This
could also use a clarification.
Arnd
next prev parent reply other threads:[~2025-10-15 7:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 4:56 [PATCH v2 0/3] Add ADSP and CDSP support on Kaanapali SoC Kumari Pallavi
2025-10-15 4:57 ` [PATCH v2 1/3] misc: fastrpc: Rename phys to dma_addr for clarity Kumari Pallavi
2025-10-15 7:20 ` Arnd Bergmann [this message]
2025-10-15 10:49 ` Kumari Pallavi
2025-10-15 10:07 ` Dmitry Baryshkov
2025-10-23 7:20 ` Kumari Pallavi
2025-10-15 4:57 ` [PATCH v2 2/3] misc: fastrpc: Add support for new DSP IOVA formatting Kumari Pallavi
2025-10-15 7:09 ` Arnd Bergmann
2025-10-15 8:52 ` Srinivas Kandagatla
2025-10-15 10:47 ` Kumari Pallavi
2025-10-18 17:25 ` Krzysztof Kozlowski
2025-10-18 17:24 ` Krzysztof Kozlowski
2025-10-23 8:35 ` Kumari Pallavi
2025-10-23 8:41 ` Krzysztof Kozlowski
2025-10-15 4:57 ` [PATCH v2 3/3] misc: fastrpc: Update dma_mask for CDSP support on Kaanapali SoC Kumari Pallavi
2025-10-15 7:06 ` Arnd Bergmann
2025-10-15 9:25 ` Srinivas Kandagatla
2025-10-15 10:47 ` 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=2e571b41-0006-4a37-9e3b-d333bf5eb7ed@app.fastmail.com \
--to=arnd@arndb.de \
--cc=aiqun.yu@oss.qualcomm.com \
--cc=amahesh@qti.qualcomm.com \
--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=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=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
all inboxes | Powered by JetHome®