iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	eric@anholt.net, Paul Mackerras <paulus@samba.org>,
	will@kernel.org, hch@lst.de, phill@raspberryi.org,
	linux-s390@vger.kernel.org, f.fainelli@gmail.com,
	frowand.list@gmail.com,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	catalin.marinas@arm.com, devicetree@vger.kernel.org,
	Vasily Gorbik <gor@linux.ibm.com>,
	marc.zyngier@arm.com, robh+dt@kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, mbrugger@suse.com,
	linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	wahrenst@gmx.net, Michael Ellerman <mpe@ellerman.id.au>,
	akpm@linux-foundation.org, Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH 6/8] dma-direct: turn ARCH_ZONE_DMA_BITS into a variable
Date: Thu, 1 Aug 2019 16:04:52 +0200	[thread overview]
Message-ID: <20190801140452.GB23435@lst.de> (raw)
In-Reply-To: <20190731154752.16557-7-nsaenzjulienne@suse.de>

A few nitpicks, otherwise this looks great:

> @@ -201,7 +202,7 @@ static int __init mark_nonram_nosave(void)
>   * everything else. GFP_DMA32 page allocations automatically fall back to
>   * ZONE_DMA.
>   *
> - * By using 31-bit unconditionally, we can exploit ARCH_ZONE_DMA_BITS to
> + * By using 31-bit unconditionally, we can exploit arch_zone_dma_bits to
>   * inform the generic DMA mapping code.  32-bit only devices (if not handled
>   * by an IOMMU anyway) will take a first dip into ZONE_NORMAL and get
>   * otherwise served by ZONE_DMA.
> @@ -237,9 +238,18 @@ void __init paging_init(void)
>  	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
>  	       (long int)((top_of_ram - total_ram) >> 20));
>  
> +	/*
> +	 * Allow 30-bit DMA for very limited Broadcom wifi chips on many
> +	 * powerbooks.
> +	 */
> +	if (IS_ENABLED(CONFIG_PPC32))
> +		arch_zone_dma_bits = 30;
> +	else
> +		arch_zone_dma_bits = 31;
> +

So the above unconditionally comment obviously isn't true any more, and
Ben also said for the recent ppc32 hack he'd prefer dynamic detection.

Maybe Ben and or other ppc folks can chime in an add a patch to the series
to sort this out now that we have a dynamic ZONE_DMA threshold?

> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> index 59bdceea3737..40dfc9b4ee4c 100644
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -19,9 +19,7 @@
>   * Most architectures use ZONE_DMA for the first 16 Megabytes, but
>   * some use it for entirely different regions:
>   */
> -#ifndef ARCH_ZONE_DMA_BITS
> -#define ARCH_ZONE_DMA_BITS 24
> -#endif
> +unsigned int arch_zone_dma_bits __ro_after_init = 24;

I'd prefer to drop the arch_ prefix and just calls this zone_dma_bits.
In the long run we really need to find a way to just automatically set
this from the meminit code, but that is out of scope for this series.
For now can you please just update the comment above to say something
like:

/*
 * Most architectures use ZONE_DMA for the first 16 Megabytes, but some use it
 * it for entirely different regions.  In that case the arch code needs to
 * override the variable below for dma-direct to work properly.
 */
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2019-08-01 14:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 15:47 [PATCH 0/8] Raspberry Pi 4 DMA addressing support Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 1/8] arm64: mm: use arm64_dma_phys_limit instead of calling max_zone_dma_phys() Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 2/8] arm64: rename variables used to calculate ZONE_DMA32's size Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 3/8] of/fdt: add function to get the SoC wide DMA addressable memory size Nicolas Saenz Julienne
2019-08-02 17:17   ` Rob Herring
2019-08-05 16:03     ` Nicolas Saenz Julienne
2019-08-05 19:23       ` Rob Herring
2019-08-06 18:12         ` Nicolas Saenz Julienne
2019-08-08 15:02           ` Rob Herring
2019-08-08 17:30             ` Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 4/8] arm64: re-introduce max_zone_dma_phys() Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 5/8] arm64: use ZONE_DMA on DMA addressing limited devices Nicolas Saenz Julienne
2019-07-31 17:07   ` Catalin Marinas
2019-08-01 15:44     ` Nicolas Saenz Julienne
2019-08-01 16:07       ` Robin Murphy
2019-08-01 16:40         ` Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 6/8] dma-direct: turn ARCH_ZONE_DMA_BITS into a variable Nicolas Saenz Julienne
2019-08-01 14:04   ` Christoph Hellwig [this message]
2019-08-01 15:59     ` Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 7/8] arm64: update arch_zone_dma_bits to fine tune dma-direct min mask Nicolas Saenz Julienne
2019-07-31 15:47 ` [PATCH 8/8] mm: comment arm64's usage of 'enum zone_type' Nicolas Saenz Julienne
2019-08-01 14:08   ` Christoph Hellwig

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=20190801140452.GB23435@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=borntraeger@de.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eric@anholt.net \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=marc.zyngier@arm.com \
    --cc=mbrugger@suse.com \
    --cc=mpe@ellerman.id.au \
    --cc=nsaenzjulienne@suse.de \
    --cc=paulus@samba.org \
    --cc=phill@raspberryi.org \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=wahrenst@gmx.net \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).