Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1359988

Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices

Path csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Sinan Kaya <okaya@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices
Date Thu, 17 Mar 2016 17:10:04 +0100
Message-ID <rdIEP-1aN-47@gated-at.bofh.it> (permalink)
References <rdIv7-Qo-7@gated-at.bofh.it> <rdIv7-Qo-5@gated-at.bofh.it>
X-Original-To Robin Murphy <robin.murphy@arm.com>, linux-arm-kernel@lists.infradead.org, timur@codeaurora.org, cov@codeaurora.org, nwatters@codeaurora.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Max Filippov <jcmvbkbc@gmail.com>, Joe Perches <joe@perches.com>, "Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>, Arnd Bergmann <arnd@arndb.de>, Jisheng Zhang <jszhang@marvell.com>, Dean Nelson <dnelson@redhat.com>, "Suzuki K. Poulose" <suzuki.poulose@arm.com>, Marek Szyprowski <m.szyprowski@samsung.com>, linux-kernel@vger.kernel.org
X-Original-Date Thu, 17 Mar 2016 12:07:26 -0400
X-Original-Message-ID <56EAD63E.2010103@codeaurora.org>
X-Original-References <1458229833-4886-1-git-send-email-okaya@codeaurora.org> <56EAD3E2.5070109@arm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1359988

Show key headers only | View raw


On 3/17/2016 11:57 AM, Robin Murphy wrote:
>> This patch modifies dma_to_phys to call iommu_iova_to_phys to perform dma
>> to phys conversions for IOMMU attached devices where dma and physical
>> addresses often have distinct values.
> 
> What's this for? dma_to_phys() is only used by SWIOTLB, and that's mutually exclusive with IOMMU ops.

If it is SWIOTLB only, then it needs to disappear from common header file as 
it is doing the wrong thing when IOMMU is enabled for a device. 

I have some device driver (HIDMA) that used dma_to_phys during DMA self test.
I needed this patch to get it working properly. I removed the self test from
my code but I still don't feel right about this dma_to_phys API returning physical
addresses.

> 
> Also, what about phys_to_dma()?

Agreed, need to fix phys_to_dma too.

> 
> Robin.

Let me know which direction I should go. 

1. Fix phys_to_dma and keep dma_to_phys as in the patch.
2. Remove both of the API from header file, move it to where it is needed. Rename them as swio_phys_to_dma etc.

-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU  attached devices Robin Murphy <robin.murphy@arm.com> - 2016-03-17 17:00 +0100
  Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU  attached devices Sinan Kaya <okaya@codeaurora.org> - 2016-03-17 17:10 +0100
    Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices Arnd Bergmann <arnd@arndb.de> - 2016-03-17 17:20 +0100
      Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU  attached devices Sinan Kaya <okaya@codeaurora.org> - 2016-03-17 17:40 +0100
        Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices Arnd Bergmann <arnd@arndb.de> - 2016-03-17 18:10 +0100

csiph-web