Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1234659ybe; Wed, 11 Sep 2019 11:30:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMbxl4WUOcn+rhUBjVv31rMWo/FoP7LzRbiYegaz4OEsH5l1sipfubK+GkqGwdMf+qaE7G X-Received: by 2002:a05:6402:134d:: with SMTP id y13mr37187594edw.209.1568226612506; Wed, 11 Sep 2019 11:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568226612; cv=none; d=google.com; s=arc-20160816; b=asCgNG5IB7QpgWwV1RI3arFjGQktQNGuL+yoFDFZr+o3+ooY/IzNvuHn6u18Ko59Hm KMsNMp9nFh+6FFpG+kdN16SjIaaNJL37F2Lv6tPaMauVeL04Fuh0Y3i2h8rUldjCL8Y0 9y4DnCOz2JT+wtJL+ZpiwLh/vh8kVKXXUk5Vl2YzhngOjwrVXjL42/Oj3B8jA7MUol3M 4qPZq0y56DrP5yQfISOqX7xRyaD7jcPOw9J1oieffYhWv1SMlJHFwJTR3U5pXAVlThkD o8ocRHtWmaARUuyI4vK1nKgpxWMmLj2agevw5dvpm/SMN7PB5pTkWa9ecZx1UhZn3Lik /jyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bQKjEodR/3cQBZPR9khrHQ23BgyrVH5C8KYCbWQxxhE=; b=TAsnJzwBHp1h8HEMIfGcqxoQNc2P8lXGTZPJWTC0SRmMJFrDQ4hbosMQhqY995rYOH xYDXKiztd0nhd4ylQbxJmHem8Di6Cy01gxObrgql9mmMCB8eSdl/5WuiREgHtle+csnD Rhqwt2Phm2AsKpCVEJZFkSTfMWSiGVHHwK1sbZIKJkA1UsMXDg/xYn+CG4ex5CWNns+k vOcqrC00eWb1aCG2fr9qLLeX9Qyaext69y82wpN4oSKJ7QKRlZFssXLOIxRv9P/hvpuy dX4PUWPSZzRI68a/I4I5n+kaXbXOtN+rilhpTHECa4OlabHlmJGf6p8q/4v3KBN3bWIW IJ2g== 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 h28si13346682edh.278.2019.09.11.11.29.49; Wed, 11 Sep 2019 11:30:12 -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 S1730069AbfIKSZ5 (ORCPT + 99 others); Wed, 11 Sep 2019 14:25:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:60022 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729985AbfIKSZ4 (ORCPT ); Wed, 11 Sep 2019 14:25:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 09BFBAE53; Wed, 11 Sep 2019 18:25:54 +0000 (UTC) From: Nicolas Saenz Julienne To: catalin.marinas@arm.com, hch@lst.de, wahrenst@gmx.net, marc.zyngier@arm.com, robh+dt@kernel.org Cc: f.fainelli@gmail.com, will@kernel.org, linux-mm@kvack.org, robin.murphy@arm.com, nsaenzjulienne@suse.de, linux-kernel@vger.kernel.org, mbrugger@suse.com, linux-rpi-kernel@lists.infradead.org, phill@raspberrypi.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Subject: [PATCH v6 4/4] mm: refresh ZONE_DMA and ZONE_DMA32 comments in 'enum zone_type' Date: Wed, 11 Sep 2019 20:25:46 +0200 Message-Id: <20190911182546.17094-5-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190911182546.17094-1-nsaenzjulienne@suse.de> References: <20190911182546.17094-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These zones usage has evolved with time and the comments were outdated. This joins both ZONE_DMA and ZONE_DMA32 explanation and gives up to date examples on how they are used on different architectures. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Christoph Hellwig Reviewed-by: Catalin Marinas --- Changes in v3: - Update comment to match changes in arm64 Changes in v2: - Try another approach merging both ZONE_DMA comments into one - Address Christoph's comments - If this approach doesn't get much traction I'll just drop the patch from the series as it's not really essential include/linux/mmzone.h | 45 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 3f38c30d2f13..bf1b916c9ecb 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -357,33 +357,40 @@ struct per_cpu_nodestat { #endif /* !__GENERATING_BOUNDS.H */ enum zone_type { -#ifdef CONFIG_ZONE_DMA /* - * ZONE_DMA is used when there are devices that are not able - * to do DMA to all of addressable memory (ZONE_NORMAL). Then we - * carve out the portion of memory that is needed for these devices. - * The range is arch specific. + * ZONE_DMA and ZONE_DMA32 are used when there are peripherals not able + * to DMA to all of the addressable memory (ZONE_NORMAL). + * On architectures where this area covers the whole 32 bit address + * space ZONE_DMA32 is used. ZONE_DMA is left for the ones with smaller + * DMA addressing constraints. This distinction is important as a 32bit + * DMA mask is assumed when ZONE_DMA32 is defined. Some 64-bit + * platforms may need both zones as they support peripherals with + * different DMA addressing limitations. + * + * Some examples: + * + * - i386 and x86_64 have a fixed 16M ZONE_DMA and ZONE_DMA32 for the + * rest of the lower 4G. + * + * - arm only uses ZONE_DMA, the size, up to 4G, may vary depending on + * the specific device. + * + * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the + * lower 4G. * - * Some examples + * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary + * depending on the specific device. * - * Architecture Limit - * --------------------------- - * parisc, ia64, sparc <4G - * s390, powerpc <2G - * arm Various - * alpha Unlimited or 0-16MB. + * - s390 uses ZONE_DMA fixed to the lower 2G. * - * i386, x86_64 and multiple other arches - * <16M. + * - ia64 and riscv only use ZONE_DMA32. + * + * - parisc uses neither. */ +#ifdef CONFIG_ZONE_DMA ZONE_DMA, #endif #ifdef CONFIG_ZONE_DMA32 - /* - * x86_64 needs two ZONE_DMAs because it supports devices that are - * only able to do DMA to the lower 16M but also 32 bit devices that - * can only do DMA areas below 4G. - */ ZONE_DMA32, #endif /* -- 2.23.0