Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Kumari Pallavi <kumari.pallavi@oss.qualcomm.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Jingyi Wang <jingyi.wang@oss.qualcomm.com>,
	Srinivas Kandagatla <srini@kernel.org>,
	Amol Maheshwari <amahesh@qti.qualcomm.com>,
	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
Subject: Re: [PATCH 1/2] misc: fastrpc: Add support for new DSP IOVA formatting
Date: Tue, 30 Sep 2025 10:10:32 +0530	[thread overview]
Message-ID: <37ac6311-bd88-4b8e-bf78-06fcdd8bdf6f@oss.qualcomm.com> (raw)
In-Reply-To: <969bdb49-0682-4345-98f7-523404bb4213@app.fastmail.com>



On 9/25/2025 11:54 AM, Arnd Bergmann wrote:
> 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?
>

I will improve the naming for better clarity:

- Replace buf->phys with buf->dma_addr throughout the code.
- Rename the macro IOVA_TO_PHYS() to something more appropriate, like 
IPA_TO_DMA_ADDR()
>       Arnd

Thanks,
Pallavi

  reply	other threads:[~2025-09-30  4:40 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 CDSP support on Kaanapali SoC 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 [this message]
2025-09-26  0:08   ` kernel test robot
2025-10-04 18:25   ` Srinivas Kandagatla
2025-09-24 23:46 ` [PATCH 2/2] misc: fastrpc: Update dma_mask for CDSP support on Kaanapali SoC Jingyi Wang
2025-09-25  2:57   ` 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=37ac6311-bd88-4b8e-bf78-06fcdd8bdf6f@oss.qualcomm.com \
    --to=kumari.pallavi@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=jingyi.wang@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