All of lore.kernel.org
 help / color / mirror / Atom feed
From: okaya@codeaurora.org
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, timur@codeaurora.org,
	cov@codeaurora.org, nwatters@codeaurora.org,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Arnaud Ebalard <arno@natisbad.org>,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 1/3] crypto: marvell/cesa - replace dma_to_phys with dma_map_single
Date: Thu, 17 Mar 2016 19:17:24 -0400	[thread overview]
Message-ID: <80402e2f82651814b1411a25b1740288@codeaurora.org> (raw)
In-Reply-To: <20160317225459.GA19428@n2100.arm.linux.org.uk>

On 2016-03-17 18:54, Russell King - ARM Linux wrote:
> On Thu, Mar 17, 2016 at 06:02:15PM -0400, Sinan Kaya wrote:
>> Getting ready to remove dma_to_phys API. Drivers should not be
>> using this API for DMA operations. Instead, they should go
>> through the dma_map or dma_alloc APIs.
>> 
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>> ---
>>  drivers/crypto/marvell/cesa.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/crypto/marvell/cesa.c 
>> b/drivers/crypto/marvell/cesa.c
>> index c0656e7..52ddfa4 100644
>> --- a/drivers/crypto/marvell/cesa.c
>> +++ b/drivers/crypto/marvell/cesa.c
>> @@ -350,8 +350,8 @@ static int mv_cesa_get_sram(struct platform_device 
>> *pdev, int idx)
>>  	if (IS_ERR(engine->sram))
>>  		return PTR_ERR(engine->sram);
>> 
>> -	engine->sram_dma = phys_to_dma(cesa->dev,
>> -				       (phys_addr_t)res->start);
>> +	engine->sram_dma = dma_map_single(cesa->dev, engine->sram,
>> +					  DMA_TO_DEVICE);
> 
> Documentation/DMA-API.txt
> 
> dma_addr_t
> dma_map_single(struct device *dev, void *cpu_addr, size_t size,
>                       enum dma_data_direction direction)
> 
> Notes:  Not all memory regions in a machine can be mapped by this API.
> Further, contiguous kernel virtual space may not be contiguous as
> physical memory.  Since this API does not provide any scatter/gather
> capability, it will fail if the user tries to map a non-physically
> contiguous piece of memory.  For this reason, memory to be mapped by
> this API should be obtained from sources which guarantee it to be
> physically contiguous (like kmalloc).
> 
> Specifically, ioremapped memory will *not* work as you expect with
> dma_map_single().


What is the correct way? I don't want to write engine->sram_dma = sram

WARNING: multiple messages have this Message-ID (diff)
From: okaya@codeaurora.org (okaya at codeaurora.org)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] crypto: marvell/cesa - replace dma_to_phys with dma_map_single
Date: Thu, 17 Mar 2016 19:17:24 -0400	[thread overview]
Message-ID: <80402e2f82651814b1411a25b1740288@codeaurora.org> (raw)
In-Reply-To: <20160317225459.GA19428@n2100.arm.linux.org.uk>

On 2016-03-17 18:54, Russell King - ARM Linux wrote:
> On Thu, Mar 17, 2016 at 06:02:15PM -0400, Sinan Kaya wrote:
>> Getting ready to remove dma_to_phys API. Drivers should not be
>> using this API for DMA operations. Instead, they should go
>> through the dma_map or dma_alloc APIs.
>> 
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>> ---
>>  drivers/crypto/marvell/cesa.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/crypto/marvell/cesa.c 
>> b/drivers/crypto/marvell/cesa.c
>> index c0656e7..52ddfa4 100644
>> --- a/drivers/crypto/marvell/cesa.c
>> +++ b/drivers/crypto/marvell/cesa.c
>> @@ -350,8 +350,8 @@ static int mv_cesa_get_sram(struct platform_device 
>> *pdev, int idx)
>>  	if (IS_ERR(engine->sram))
>>  		return PTR_ERR(engine->sram);
>> 
>> -	engine->sram_dma = phys_to_dma(cesa->dev,
>> -				       (phys_addr_t)res->start);
>> +	engine->sram_dma = dma_map_single(cesa->dev, engine->sram,
>> +					  DMA_TO_DEVICE);
> 
> Documentation/DMA-API.txt
> 
> dma_addr_t
> dma_map_single(struct device *dev, void *cpu_addr, size_t size,
>                       enum dma_data_direction direction)
> 
> Notes:  Not all memory regions in a machine can be mapped by this API.
> Further, contiguous kernel virtual space may not be contiguous as
> physical memory.  Since this API does not provide any scatter/gather
> capability, it will fail if the user tries to map a non-physically
> contiguous piece of memory.  For this reason, memory to be mapped by
> this API should be obtained from sources which guarantee it to be
> physically contiguous (like kmalloc).
> 
> Specifically, ioremapped memory will *not* work as you expect with
> dma_map_single().


What is the correct way? I don't want to write engine->sram_dma = sram

  reply	other threads:[~2016-03-17 23:17 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 22:02 [PATCH 1/3] crypto: marvell/cesa - replace dma_to_phys with dma_map_single Sinan Kaya
2016-03-17 22:02 ` Sinan Kaya
2016-03-17 22:02 ` [PATCH 2/3] swiotlb: prefix dma_to_phys and phys_to_dma functions Sinan Kaya
2016-03-17 22:02   ` Sinan Kaya
2016-03-17 22:02   ` Sinan Kaya
2016-03-18 12:12   ` Robin Murphy
2016-03-18 12:12     ` Robin Murphy
2016-03-18 12:12     ` Robin Murphy
2016-03-18 15:00     ` Sinan Kaya
2016-03-18 15:00       ` Sinan Kaya
2016-03-18 15:00       ` Sinan Kaya
2016-03-28 18:29       ` Konrad Rzeszutek Wilk
2016-03-28 18:29         ` Konrad Rzeszutek Wilk
2016-03-28 18:29         ` Konrad Rzeszutek Wilk
2016-03-29 12:44         ` Stefano Stabellini
2016-03-29 12:44           ` Stefano Stabellini
2016-03-29 12:44           ` Stefano Stabellini
2016-03-29 12:57           ` Sinan Kaya
2016-03-29 12:57             ` Sinan Kaya
2016-03-29 12:57             ` Sinan Kaya
2016-03-29 19:32         ` Arnd Bergmann
2016-03-29 19:32           ` Arnd Bergmann
2016-03-29 19:32           ` Arnd Bergmann
2016-03-17 22:02 ` [PATCH 3/3] dma-mapping: move swiotlb dma-phys functions to common header Sinan Kaya
2016-03-17 22:02   ` Sinan Kaya
2016-03-17 22:02   ` Sinan Kaya
2016-03-18 11:31   ` Robin Murphy
2016-03-18 11:31     ` Robin Murphy
2016-03-18 13:55     ` Sinan Kaya
2016-03-18 13:55       ` Sinan Kaya
2016-03-18 13:55       ` Sinan Kaya
2016-03-17 22:54 ` [PATCH 1/3] crypto: marvell/cesa - replace dma_to_phys with dma_map_single Russell King - ARM Linux
2016-03-17 22:54   ` Russell King - ARM Linux
2016-03-17 23:17   ` okaya [this message]
2016-03-17 23:17     ` okaya at codeaurora.org
2016-03-17 23:50     ` Russell King - ARM Linux
2016-03-17 23:50       ` Russell King - ARM Linux
2016-03-18  9:30       ` Boris Brezillon
2016-03-18  9:30         ` Boris Brezillon
2016-03-18 11:25         ` Robin Murphy
2016-03-18 11:25           ` Robin Murphy
2016-03-18 11:32           ` Boris Brezillon
2016-03-18 11:32             ` Boris Brezillon
2016-03-18 13:51           ` Sinan Kaya
2016-03-18 13:51             ` Sinan Kaya
2016-03-18 14:00             ` Sinan Kaya
2016-03-18 14:00               ` Sinan Kaya
2016-03-18 14:20             ` Boris Brezillon
2016-03-18 14:20               ` Boris Brezillon
2016-03-18 14:21               ` Sinan Kaya
2016-03-18 14:21                 ` Sinan Kaya
2016-03-18 20:18 ` kbuild test robot
2016-03-18 20:18   ` kbuild test robot

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=80402e2f82651814b1411a25b1740288@codeaurora.org \
    --to=okaya@codeaurora.org \
    --cc=arno@natisbad.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=cov@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nwatters@codeaurora.org \
    --cc=timur@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.