[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <969bdb49-0682-4345-98f7-523404bb4213@app.fastmail.com>
Date: Thu, 25 Sep 2025 08:24:21 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Jingyi Wang" <jingyi.wang@....qualcomm.com>,
"Srinivas Kandagatla" <srini@...nel.org>,
"Amol Maheshwari" <amahesh@....qualcomm.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc: aiqun.yu@....qualcomm.com, tingwei.zhang@....qualcomm.com,
trilok.soni@....qualcomm.com, yijie.yang@....qualcomm.com,
linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
"Kumari Pallavi" <kumari.pallavi@....qualcomm.com>
Subject: Re: [PATCH 1/2] misc: fastrpc: Add support for new DSP IOVA formatting
On Thu, Sep 25, 2025, at 01:46, Jingyi Wang wrote:
> dma_free_coherent(buf->dev, buf->size, buf->virt,
> - FASTRPC_PHYS(buf->phys));
> + IOVA_TO_PHYS(buf->phys, sid_pos));
> kfree(buf);
> }
I understand what you are doing, but the naming of the macros
seems a bit confusing: dma_free_coherent() and the related
functions are designed to take an IOVA argument, not a physical
address, so calling IOVA_TO_PHYS() before passing the
address sounds wrong. This is made worse by the naming
of 'buf->phys' that is not a physical address at all
but already transformed twice into a dma_addr_t and
from there into a dma_addr+sid tuple.
Ideally the SID handling would be abstracted behind a custom
dma_map_ops implementation that treats this as a custom
iommu, but if the fastrpc device is the only user of this
address format, I can understand you want to keep this as
a local hack in this driver.
Can you try to come up with some better naming here, and
replace the 'phys' bits with something that is more fitting
for an iova/dma_addr_t?
Arnd
Powered by blists - more mailing lists