mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>, iommu@lists.linux-foundation.org
Cc: linux-arch@vger.kernel.org, linux-mips@linux-mips.org,
	"Michal Simek" <monstr@monstr.eu>,
	linux-ia64@vger.kernel.org,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"Konrad Rzeszutek Wilk" <konrad@darnok.org>,
	"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 21/22] arm64: replace ZONE_DMA with ZONE_DMA32
Date: Wed, 10 Jan 2018 12:58:14 +0000	[thread overview]
Message-ID: <0371cef8-d980-96da-9cb5-3609c39be18a@arm.com> (raw)
In-Reply-To: <20180110080932.14157-22-hch@lst.de>

On 10/01/18 08:09, Christoph Hellwig wrote:
> arm64 uses ZONE_DMA for allocations below 32-bits.  These days we
> name the zone for that ZONE_DMA32, which will allow to use the
> dma-direct and generic swiotlb code as-is, so rename it.

I do wonder if we could also "upgrade" GFP_DMA to GFP_DMA32 somehow when 
!ZONE_DMA - there are almost certainly arm64 drivers out there using a 
combination of GFP_DMA and streaming mappings which will no longer get 
the guaranteed 32-bit addresses they expect after this. I'm not sure 
quite how feasible that is, though :/

That said, I do agree that this is an appropriate change (the legacy of 
GFP_DMA is obviously horrible), so, provided we get plenty of time to 
find and fix the fallout when it lands:

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

Robin.

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   arch/arm64/Kconfig          |  2 +-
>   arch/arm64/mm/dma-mapping.c |  6 +++---
>   arch/arm64/mm/init.c        | 16 ++++++++--------
>   3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index c9a7e9e1414f..6b6985f15d02 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -227,7 +227,7 @@ config GENERIC_CSUM
>   config GENERIC_CALIBRATE_DELAY
>   	def_bool y
>   
> -config ZONE_DMA
> +config ZONE_DMA32
>   	def_bool y
>   
>   config HAVE_GENERIC_GUP
> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> index 6840426bbe77..0d641875b20e 100644
> --- a/arch/arm64/mm/dma-mapping.c
> +++ b/arch/arm64/mm/dma-mapping.c
> @@ -95,9 +95,9 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
>   				  dma_addr_t *dma_handle, gfp_t flags,
>   				  unsigned long attrs)
>   {
> -	if (IS_ENABLED(CONFIG_ZONE_DMA) &&
> +	if (IS_ENABLED(CONFIG_ZONE_DMA32) &&
>   	    dev->coherent_dma_mask <= DMA_BIT_MASK(32))
> -		flags |= GFP_DMA;
> +		flags |= GFP_DMA32;
>   	if (dev_get_cma_area(dev) && gfpflags_allow_blocking(flags)) {
>   		struct page *page;
>   		void *addr;
> @@ -397,7 +397,7 @@ static int __init atomic_pool_init(void)
>   		page = dma_alloc_from_contiguous(NULL, nr_pages,
>   						 pool_size_order, GFP_KERNEL);
>   	else
> -		page = alloc_pages(GFP_DMA, pool_size_order);
> +		page = alloc_pages(GFP_DMA32, pool_size_order);
>   
>   	if (page) {
>   		int ret;
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 00e7b900ca41..8f03276443c9 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -217,7 +217,7 @@ static void __init reserve_elfcorehdr(void)
>   }
>   #endif /* CONFIG_CRASH_DUMP */
>   /*
> - * Return the maximum physical address for ZONE_DMA (DMA_BIT_MASK(32)). It
> + * Return the maximum physical address for ZONE_DMA32 (DMA_BIT_MASK(32)). It
>    * currently assumes that for memory starting above 4G, 32-bit devices will
>    * use a DMA offset.
>    */
> @@ -233,8 +233,8 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
>   {
>   	unsigned long max_zone_pfns[MAX_NR_ZONES]  = {0};
>   
> -	if (IS_ENABLED(CONFIG_ZONE_DMA))
> -		max_zone_pfns[ZONE_DMA] = PFN_DOWN(max_zone_dma_phys());
> +	if (IS_ENABLED(CONFIG_ZONE_DMA32))
> +		max_zone_pfns[ZONE_DMA32] = PFN_DOWN(max_zone_dma_phys());
>   	max_zone_pfns[ZONE_NORMAL] = max;
>   
>   	free_area_init_nodes(max_zone_pfns);
> @@ -251,9 +251,9 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
>   	memset(zone_size, 0, sizeof(zone_size));
>   
>   	/* 4GB maximum for 32-bit only capable devices */
> -#ifdef CONFIG_ZONE_DMA
> +#ifdef CONFIG_ZONE_DMA32
>   	max_dma = PFN_DOWN(arm64_dma_phys_limit);
> -	zone_size[ZONE_DMA] = max_dma - min;
> +	zone_size[ZONE_DMA32] = max_dma - min;
>   #endif
>   	zone_size[ZONE_NORMAL] = max - max_dma;
>   
> @@ -266,10 +266,10 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
>   		if (start >= max)
>   			continue;
>   
> -#ifdef CONFIG_ZONE_DMA
> +#ifdef CONFIG_ZONE_DMA32
>   		if (start < max_dma) {
>   			unsigned long dma_end = min(end, max_dma);
> -			zhole_size[ZONE_DMA] -= dma_end - start;
> +			zhole_size[ZONE_DMA32] -= dma_end - start;
>   		}
>   #endif
>   		if (end > max_dma) {
> @@ -467,7 +467,7 @@ void __init arm64_memblock_init(void)
>   	early_init_fdt_scan_reserved_mem();
>   
>   	/* 4GB maximum for 32-bit only capable devices */
> -	if (IS_ENABLED(CONFIG_ZONE_DMA))
> +	if (IS_ENABLED(CONFIG_ZONE_DMA32))
>   		arm64_dma_phys_limit = max_zone_dma_phys();
>   	else
>   		arm64_dma_phys_limit = PHYS_MASK + 1;
> 

  reply	other threads:[~2018-01-10 12:58 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  8:09 consolidate swiotlb dma_map implementations Christoph Hellwig
2018-01-10  8:09 ` [PATCH 01/22] swiotlb: suppress warning when __GFP_NOWARN is set Christoph Hellwig
2018-01-10  8:09 ` [PATCH 02/22] arm64: rename swiotlb_dma_ops Christoph Hellwig
2018-01-10 12:13   ` Robin Murphy
2018-01-10  8:09 ` [PATCH 03/22] ia64: " Christoph Hellwig
2018-01-12 13:24   ` Konrad Rzeszutek Wilk
2018-01-10  8:09 ` [PATCH 04/22] powerpc: " Christoph Hellwig
2018-01-12 13:25   ` Konrad Rzeszutek Wilk
2018-01-10  8:09 ` [PATCH 05/22] x86: " Christoph Hellwig
2018-01-12 13:25   ` Konrad Rzeszutek Wilk
2018-01-10  8:09 ` [PATCH 06/22] swiotlb: rename swiotlb_free to swiotlb_exit Christoph Hellwig
2018-01-12 13:39   ` Konrad Rzeszutek Wilk
2018-01-10  8:09 ` [PATCH 07/22] swiotlb: add common swiotlb_map_ops Christoph Hellwig
2018-01-10  8:09 ` [PATCH 08/22] swiotlb: wire up ->dma_supported in swiotlb_dma_ops Christoph Hellwig
2018-01-10 12:16   ` Robin Murphy
2018-01-10 15:35     ` Christoph Hellwig
2018-01-10 17:23       ` Robin Murphy
2018-01-10  8:09 ` [PATCH 09/22] swiotlb: refactor coherent buffer freeing Christoph Hellwig
2018-01-10  8:09 ` [PATCH 10/22] swiotlb: refactor coherent buffer allocation Christoph Hellwig
2018-01-10 12:22   ` Robin Murphy
2018-01-10 15:46     ` Christoph Hellwig
2018-01-10 17:02       ` Robin Murphy
2018-01-15  9:10         ` Christoph Hellwig
2018-01-10  8:09 ` [PATCH 11/22] swiotlb: remove various exports Christoph Hellwig
2018-01-10  8:09 ` [PATCH 12/22] ia64: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10  8:09 ` [PATCH 13/22] ia64: use generic swiotlb_ops Christoph Hellwig
2018-01-10  8:09 ` [PATCH 14/22] ia64: clean up swiotlb support Christoph Hellwig
2018-01-10  8:09 ` [PATCH 15/22] ia64: remove an ifdef around the content of pci-dma.c Christoph Hellwig
2018-01-10  8:09 ` [PATCH 16/22] unicore32: use generic swiotlb_ops Christoph Hellwig
2018-01-10  8:09 ` [PATCH 17/22] tile: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10  8:09 ` [PATCH 18/22] tile: use generic swiotlb_ops Christoph Hellwig
2018-01-10  8:09 ` [PATCH 19/22] mips/netlogic: remove swiotlb support Christoph Hellwig
2018-01-10  8:09 ` [PATCH 20/22] mips: use swiotlb_{alloc,free} Christoph Hellwig
2018-01-10  8:09 ` [PATCH 21/22] arm64: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10 12:58   ` Robin Murphy [this message]
2018-01-10 15:55     ` Christoph Hellwig
2018-01-10 15:55       ` Christoph Hellwig
2018-01-10 17:10         ` Robin Murphy
2018-01-10  8:09 ` [PATCH 22/22] arm64: use swiotlb_alloc and swiotlb_free Christoph Hellwig
2018-01-10 13:16   ` Robin Murphy
2018-01-10  8:23 ` consolidate swiotlb dma_map implementations Christian König
2018-01-16  7:53 ` Christoph Hellwig
2018-01-16  8:22   ` Christian König
2018-01-16  8:28     ` Christoph Hellwig
2018-01-16  8:52       ` Christian König

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=0371cef8-d980-96da-9cb5-3609c39be18a@arm.com \
    --to=robin.murphy@arm.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=konrad@darnok.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=monstr@monstr.eu \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®