get rid of dma_max_pfn
Subsystems (3)
Hi everyone,
I though I got rid of all non-highmem, non-ISA block layer bounce buffering a while ago, but I missed the MMC case. While I still plan to also kill off the highmem bouncing there I won't get to it this merge window, so for now I'd like to make some progress and move MMC to the DMA layer (swiotlb or arm dmabounce) bouncing for addressing limitations and kill off the dma_max_pfn helper.
I'm fine with merging this through the mmc tree if it suits everyone.
PATCH 1/2 mmc: let the dma map ops handle bouncing
Just like we do for all other block drivers. Especially as the limit imposed at the moment might be way to pessimistic for iommus.
--- drivers/mmc/core/queue.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/core/queue.c +2 -5
@@ -350,18 +350,15 @@ static const struct blk_mq_ops mmc_mq_ops = {static void mmc_setup_queue (struct mmc_queue *mq,struct mmc_card *card) {struct mmc_host *host = card->host; -u64 limit =BLK_BOUNCE_HIGH ;unsigned block_size =512 ; -if (mmc_dev (host)->dma_mask && *mmc_dev (host)->dma_mask) - limit = (u64 )dma_max_pfn (mmc_dev (host)) <<PAGE_SHIFT ; -blk_queue_flag_set (QUEUE_FLAG_NONROT , mq->queue);blk_queue_flag_clear (QUEUE_FLAG_ADD_RANDOM , mq->queue);if (mmc_can_erase (card))mmc_queue_setup_discard (mq->queue, card); -blk_queue_bounce_limit (mq->queue, limit); +if (!mmc_dev (host)->dma_mask || !*mmc_dev (host)->dma_mask) +blk_queue_bounce_limit (mq->queue,BLK_BOUNCE_HIGH );blk_queue_max_hw_sectors (mq->queue,min (host->max_blk_count, host->max_req_size /512 ));blk_queue_max_segments (mq->queue, host->max_segs);
Signature · 1 line
2.20.1
Re: [PATCH 1/2] mmc: let the dma map ops handle bouncing
Quoted 7 lines · Christoph Hellwig
Just like we do for all other block drivers. Especially as the limit imposed at the moment might be way to pessimistic for iommus.
Signed-off-by Christoph Hellwig <[email protected]>From your earlier reply, I decided to fold in the following
information to the changelog, as to clarify things a bit:
"This also means we are not going to set a bounce limit for the queue, in case we have a dma mask. On most architectures it was never needed, the major hold out was x86-32 with PAE, but that has been fixed by now."
Please tell, if you want me to change something.
Applied for next, thanks!
Kind regards
Uffe
Quoted 32 lines
--- drivers/mmc/core/queue.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/mmc/core/queue.c +2
-6@@ -350,18 +350,15 @@ static const struct blk_mq_ops mmc_mq_ops = {static void mmc_setup_queue (struct mmc_queue *mq,struct mmc_card *card) {struct mmc_host *host = card->host; -u64 limit =BLK_BOUNCE_HIGH ;unsigned block_size =512 ; -if (mmc_dev (host)->dma_mask && *mmc_dev (host)->dma_mask) - limit = (u64 )dma_max_pfn (mmc_dev (host)) <<PAGE_SHIFT ; -blk_queue_flag_set (QUEUE_FLAG_NONROT , mq->queue);blk_queue_flag_clear (QUEUE_FLAG_ADD_RANDOM , mq->queue);if (mmc_can_erase (card))mmc_queue_setup_discard (mq->queue, card); -blk_queue_bounce_limit (mq->queue, limit); +if (!mmc_dev (host)->dma_mask || !*mmc_dev (host)->dma_mask) +blk_queue_bounce_limit (mq->queue,BLK_BOUNCE_HIGH );blk_queue_max_hw_sectors (mq->queue,min (host->max_blk_count, host->max_req_size /512 ));blk_queue_max_segments (mq->queue, host->max_segs); --2.20.1
PATCH 2/2 dma-mapping: remove dma_max_pfn
In reply to Christoph HellwigThese days the DMA mapping code must bounce buffer for any not supported address, and if they driver needs to optimize for natively supported ranged it should use dma_get_required_mask.
--- arch/arm/include/asm/dma-mapping.h | 7 ------- include/linux/dma-mapping.h | 7 ------- 2 files changed, 14 deletions(-)
arch/arm/include/asm/dma-mapping.h +0 -7
@@ -89,13 +89,6 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) }#endif -/* The ARM override for dma_max_pfn() */ -static inline unsigned long dma_max_pfn (struct device *dev) -{ -return dma_to_pfn (dev, *dev->dma_mask); -} -#define dma_max_pfn (dev) dma_max_pfn(dev) -/* do not use this function in a driver */ static inline bool is_device_dma_coherent (struct device *dev) {
include/linux/dma-mapping.h +0 -7
@@ -729,13 +729,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)return -EIO ; } -#ifndef dma_max_pfn -static inline unsigned long dma_max_pfn (struct device *dev) -{ -return (*dev->dma_mask >>PAGE_SHIFT ) + dev->dma_pfn_offset; -} -#endif -static inline int dma_get_cache_alignment (void ) {#ifdef ARCH_DMA_MINALIGN
Signature · 1 line
2.20.1
Re: [PATCH 2/2] dma-mapping: remove dma_max_pfn
Hello Christoph,
There are some typos in the commit message that make it harder (for me) to parse.
Quoted 1 line · Christoph Hellwig
These days the DMA mapping code must bounce buffer for any not supported
Add comma after "These days" ?
s/must bounce buffer/must bounce buffers/ ?
s/not supported/unsupported/ ?
Quoted 1 line
address, and if they driver needs to optimize for natively supported
s/if they driver/if the driver/ ?
Quoted 1 line
ranged it should use
dma_get_required_mask.
s/ranged it should/ranges, then it should/ ?
Regards.
Re: [PATCH 2/2] dma-mapping: remove dma_max_pfn
Quoted 4 lines · Marc Gonzalez
Hello Christoph,
There are some typos in the commit message that make it harder (for me) to parse.
The fixes looks good to me. Ulf, do you want me to resend?
Re: [PATCH 2/2] dma-mapping: remove dma_max_pfn
In reply to Christoph HellwigQuoted 6 lines · Christoph Hellwig
These days the DMA mapping code must bounce buffer for any not supported address, and if they driver needs to optimize for natively supported ranged it should use
dma_get_required_mask.Signed-off-by Christoph Hellwig <[email protected]>
Applied for next, by amending the changelog according to suggestions from Marc, thanks!
I also decided to consider to the reply from Marc (with the changes made) as an ack, so added a tag for that.
If there are any objections, from anyone, please tell now.
Kind regards
Uffe
Quoted 44 lines
--- arch/arm/include/asm/dma-mapping.h | 7 ------- include/linux/dma-mapping.h | 7 ------- 2 files changed, 14 deletions(-)arch/arm/include/asm/dma-mapping.h +0
-7@@ -89,13 +89,6 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) }#endif -/* The ARM override for dma_max_pfn() */ -static inline unsigned long dma_max_pfn (struct device *dev) -{ -return dma_to_pfn (dev, *dev->dma_mask); -} -#define dma_max_pfn (dev) dma_max_pfn(dev) -/* do not use this function in a driver */ static inline bool is_device_dma_coherent (struct device *dev) {include/linux/dma-mapping.h +0
-8@@ -729,13 +729,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)return -EIO ; } -#ifndef dma_max_pfn -static inline unsigned long dma_max_pfn (struct device *dev) -{ -return (*dev->dma_mask >>PAGE_SHIFT ) + dev->dma_pfn_offset; -} -#endif -static inline int dma_get_cache_alignment (void ) {#ifdef ARCH_DMA_MINALIGN --2.20.1