Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7414978ybi; Thu, 1 Aug 2019 07:52:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1jzrzIP+pYhhxVCVGzR+o+dEU4MvZ8SiWuuvce3EGa4zNtWwgEHI7pjwfVFQjdhgtixpU X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr128598480plz.38.1564671143524; Thu, 01 Aug 2019 07:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564671143; cv=none; d=google.com; s=arc-20160816; b=FGGZe7Aw2JGCA6QEAq2Ezluibo9qykKiYNGx07osiqQjqQsyK6PRIMtHrHB6zZ/qy6 nQc8YEijmoJD7sjK5e+fBPLF1z8OHcjEMEThTlOfE+GCy//V659gqk13X9cN4qutsagw b/JTvTTbXTzZ/D4pG889NHRrlwEYAJj+GAAwj8e6LgNzAll7oILNtH1d0xpQNoln3Ynn QKHNWZE9k04bLrPouZ3/PPDayrl1UALET7+IbWZfJn50p7BKK2CQ+GkrKd9bB4W6wHwQ yGwhhimiHzuojChD3JHjVqH1inMLdwPLEvuCtfOLWWhis1o+xuU0Ea7VanbyWrfRpiHz xn1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YGCp3WnRy55OAoIwvD1C6aZvr5KPp1dJlrn5QrAMEWg=; b=cBEAR0rVqwrr5ucUXeDHBLh7fl3KmR13HgnaMg7X99S6CC53hcfcPhY7yd+cDz28kp 53ck7zNlH07YeHRbA2Fi5fAtb3vvVfKaOyYNBtdYB/a8F8RVuCOUO3lNH9Gwi4HR5Mj2 h3Goxzx+mtf7m1WqjvGaBK5QQLkn2rWK+9nncqMmvrHpOsTE+nW7jjyrB+1wtR0ImnDk f5kl9MRvyz5Ptd5ssdPqu//dNKiVzAaPXuS3viiXA5YxIFw6Vt7XsvC0HTbSmvuyfPnd w4bOeXW9NXjQWetb+OOzjjjdKzVTJ/zmmZ8UgLZKLjlAkHIAX7DUjaUR2yS9ceziXORE Mpag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62si35268736pgd.170.2019.08.01.07.52.07; Thu, 01 Aug 2019 07:52:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731634AbfHAOE6 (ORCPT + 99 others); Thu, 1 Aug 2019 10:04:58 -0400 Received: from verein.lst.de ([213.95.11.211]:43759 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730581AbfHAOE5 (ORCPT ); Thu, 1 Aug 2019 10:04:57 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 5620168AFE; Thu, 1 Aug 2019 16:04:52 +0200 (CEST) Date: Thu, 1 Aug 2019 16:04:52 +0200 From: Christoph Hellwig To: Nicolas Saenz Julienne Cc: catalin.marinas@arm.com, hch@lst.de, wahrenst@gmx.net, marc.zyngier@arm.com, Robin Murphy , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, Marek Szyprowski , phill@raspberryi.org, f.fainelli@gmail.com, will@kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, eric@anholt.net, mbrugger@suse.com, akpm@linux-foundation.org, frowand.list@gmail.com, linux-rpi-kernel@lists.infradead.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 6/8] dma-direct: turn ARCH_ZONE_DMA_BITS into a variable Message-ID: <20190801140452.GB23435@lst.de> References: <20190731154752.16557-1-nsaenzjulienne@suse.de> <20190731154752.16557-7-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190731154752.16557-7-nsaenzjulienne@suse.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. */