iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Jonathan Lemon <jlemon@flugsvamp.com>
Cc: Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Madalin Bucur <madalin.bucur@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Leo Li <leoyang.li@nxp.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH v2 3/3] dpaa2_eth: use new unmap and sync dma api variants
Date: Mon, 28 Oct 2019 10:55:05 +0000	[thread overview]
Message-ID: <00a138f0-3651-5441-7241-5f02956b6c2c@nxp.com> (raw)
In-Reply-To: <BC2F1623-D8A5-4A6E-BAF4-5C551637E472@flugsvamp.com>

Hi Jonathan,

On 25.10.2019 19:12, Jonathan Lemon wrote:
> 
> 
> On 24 Oct 2019, at 5:41, Laurentiu Tudor wrote:
> 
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> Convert this driver to usage of the newly introduced dma unmap and
>> sync DMA APIs. This will get rid of the unsupported direct usage of
>> iommu_iova_to_phys() API.
>>
>> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>> ---
>>  .../net/ethernet/freescale/dpaa2/dpaa2-eth.c  | 40 +++++++------------
>>  .../net/ethernet/freescale/dpaa2/dpaa2-eth.h  |  1 -
>>  2 files changed, 15 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c 
>> b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
>> index 19379bae0144..8c3391e6e598 100644
>> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
>> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
>> @@ -29,16 +29,6 @@ MODULE_LICENSE("Dual BSD/GPL");
>>  MODULE_AUTHOR("Freescale Semiconductor, Inc");
>>  MODULE_DESCRIPTION("Freescale DPAA2 Ethernet Driver");
>>
>> -static void *dpaa2_iova_to_virt(struct iommu_domain *domain,
>> -                dma_addr_t iova_addr)
>> -{
>> -    phys_addr_t phys_addr;
>> -
>> -    phys_addr = domain ? iommu_iova_to_phys(domain, iova_addr) : 
>> iova_addr;
>> -
>> -    return phys_to_virt(phys_addr);
>> -}
>> -
>>  static void validate_rx_csum(struct dpaa2_eth_priv *priv,
>>                   u32 fd_status,
>>                   struct sk_buff *skb)
>> @@ -85,9 +75,10 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv,
>>      sgt = vaddr + dpaa2_fd_get_offset(fd);
>>      for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
>>          addr = dpaa2_sg_get_addr(&sgt[i]);
>> -        sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
>> -        dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
>> -                   DMA_BIDIRECTIONAL);
>> +        sg_vaddr = page_to_virt
>> +                (dma_unmap_page_desc(dev, addr,
>> +                            DPAA2_ETH_RX_BUF_SIZE,
>> +                            DMA_BIDIRECTIONAL));
> 
> This is doing virt -> page -> virt.  Why not just have the new
> function return the VA corresponding to the addr, which would
> match the other functions?

I'd really like that as it would get rid of the page_to_virt() calls but 
it will break the symmetry with the dma_map_page() API. I'll let the 
maintainers decide.

---
Best Regards, Laurentiu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2019-10-28 10:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 12:41 [PATCH v2 0/3] dma-mapping: introduce new dma unmap and sync variants Laurentiu Tudor
2019-10-24 12:41 ` [PATCH v2 1/3] dma-mapping: introduce new dma unmap and sync api variants Laurentiu Tudor
2019-10-28 12:38   ` hch
2019-10-29  7:05     ` Laurentiu Tudor
2019-10-28 13:42   ` Robin Murphy
2019-11-06 11:32     ` Laurentiu Tudor
2019-11-07 12:30     ` Laurentiu Tudor
2019-10-30  9:48   ` kbuild test robot
2019-10-24 12:41 ` [PATCH v2 2/3] iommu/dma: wire-up new dma map op .get_virt_addr Laurentiu Tudor
2019-10-28 13:52   ` Robin Murphy
2019-10-24 12:41 ` [PATCH v2 3/3] dpaa2_eth: use new unmap and sync dma api variants Laurentiu Tudor
2019-10-25 16:12   ` Jonathan Lemon
2019-10-28 10:55     ` Laurentiu Tudor [this message]
2019-10-28 11:38       ` hch
2019-11-06 11:17         ` Laurentiu Tudor

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=00a138f0-3651-5441-7241-5f02956b6c2c@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=ioana.ciornei@nxp.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jlemon@flugsvamp.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=ruxandra.radulescu@nxp.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;
as well as URLs for NNTP newsgroup(s).