From patchwork Tue Aug 20 14:58:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11103987 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 625341398 for ; Tue, 20 Aug 2019 15:00:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C61A22DA9 for ; Tue, 20 Aug 2019 15:00:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p5OzwKYl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C61A22DA9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DZKR5KlyPLt7/gDGcxYQRnhuVbFNW0vkDDkc2Wo+ASc=; b=p5OzwKYlM7piiE cfSvt9kdJ6zArEd/wAJYX1kwEXPg0O+1bIv/1duxPmAEsiFDEMKT3MumsS/yCp1IWd6NAG+gsC89L 1klhRAE92Zx7wcEmM0qclJYm8pSNOENaSyjsG4S6v3aXw06BHzlTDkfDgQbDZlbpJ/Zgxlox26Yv/ 1ib29OF+vfjMFgGLf42kv5C6GD8637YEJZcMxf4kW0/A6HtXkbb6vp9r4YDw+dAw41BHgTOyF1fN6 rzI0MGoxuCN3gqQUvuHfnoP5YSmQ3FGx1a0/K+Po4dDuM4H9UjEmWNFZWDaLXljJ8GlRmFxLjIO3B 3MyAp82uOF1/JeoZ9GfA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05cG-0006er-3w; Tue, 20 Aug 2019 15:00:08 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05al-0004zR-Fe; Tue, 20 Aug 2019 14:58:36 +0000 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 292BEAFCB; Tue, 20 Aug 2019 14:58:34 +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, Robin Murphy , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Frank Rowand Subject: [PATCH v2 04/11] of/fdt: add early_init_dt_get_dma_zone_size() Date: Tue, 20 Aug 2019 16:58:12 +0200 Message-Id: <20190820145821.27214-5-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190820145821.27214-1-nsaenzjulienne@suse.de> References: <20190820145821.27214-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075835_663684_1719E8FE X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.135.220.15 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: phill@raspberryi.org, f.fainelli@gmail.com, linux-kernel@vger.kernel.org, eric@anholt.net, mbrugger@suse.com, linux-rpi-kernel@lists.infradead.org, akpm@linux-foundation.org, will@kernel.org, nsaenzjulienne@suse.de, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some devices might have weird DMA addressing limitations that only apply to a subset of the available peripherals. For example the Raspberry Pi 4 has two interconnects, one able to address the whole lower 4G memory area and another one limited to the lower 1G. Being an uncommon situation we simply hardcode the device wide DMA addressable memory size conditionally to the machine compatible name and set 'dma_zone_size' accordingly. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes in v2: - New approach to getting dma_zone_size, instead of parsing the dts we hardcode it conditionally to the machine compatible name. drivers/of/fdt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 06ffbd39d9af..f756e8c05a77 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -27,6 +27,7 @@ #include /* for COMMAND_LINE_SIZE */ #include +#include /* for dma_zone_size */ #include "of_private.h" @@ -1195,6 +1196,12 @@ void __init early_init_dt_scan_nodes(void) of_scan_flat_dt(early_init_dt_scan_memory, NULL); } +void __init early_init_dt_get_dma_zone_size(void) +{ + if (of_fdt_machine_is_compatible("brcm,bcm2711")) + dma_zone_size = 0x3c000000; +} + bool __init early_init_dt_scan(void *params) { bool status; @@ -1204,6 +1211,7 @@ bool __init early_init_dt_scan(void *params) return false; early_init_dt_scan_nodes(); + early_init_dt_get_dma_zone_size(); return true; }