Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6128955ybi; Wed, 31 Jul 2019 08:49:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHjuld2vLwpjLCI2USHDjFgDpcWsTRwUd4sjzrMBb5BkPo/hrEbWJmmiDhi2Sv2pFwlrE9 X-Received: by 2002:a65:68c8:: with SMTP id k8mr29881361pgt.192.1564588166848; Wed, 31 Jul 2019 08:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564588166; cv=none; d=google.com; s=arc-20160816; b=goB0nOh1QW6Rq7/i9Naya3MlIglN94WEebNhzLiHc8c5bvjYzNM2eO7FEtReipp1k4 kyMtXnHfjBRTDyiT8YAYBg0iXG9ZnUsbvTeOyvhCAG840LM7XoULZXm9LXSqu0JnEhap hdqS08y1BVfI1PcGhvTS/HZeD9ndHqFeQqlxjpP2IW2Y+nSY/6G3WILAMAOupSL1HgVS wXLs4/SO22GHHrirJhPhDps0p77GQ2ERdJVqMGG+A2hGyi8/noBBMQdeCJ432IDfDc9+ TCcqPfjaKHLq6tbDGXhHHO+n+gD95ewhZtNcM4X9RYdSVCpjuY1KaFa03v4ZkKm/oIb+ /T7w== 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 :message-id:date:subject:cc:to:from; bh=8we86U6BZ89U18xVZ5Mv4qd+dqLJCUI8fI0+y76c8U0=; b=zgRsLk7I0RIiNYr3dwAmgqeMXhLil3QGgJ7yVArW8AUQOR1lfEHYbq/k5EX2hCCOkQ CyapbM3tpPhkwaxpjRecCcTrZPuoFngUyY5eBasb3LS0CY04ds2sBt6OxTNC5USRIqCq O1rrtav84775+DeK8lEK4QYA5w01Hu4jxpOe0/utAHJlFIlK5iPyMQMR3JfvyIXUThRR La8lsOy0s+Gi15sKie98mN7y5Bo7npSL8BR/0ztLT2k4TMLtkQ5HqBtP8UqhM9q70/LF ozWV4BNM8UVqbev3JXtHh2TFkq3I0HS+rCjGQN70V4HA9hquMcKHQIyjFgVAsm+X3tLp zw7g== 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 l97si1824028pje.6.2019.07.31.08.49.11; Wed, 31 Jul 2019 08:49:26 -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 S1729823AbfGaPsD (ORCPT + 99 others); Wed, 31 Jul 2019 11:48:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:49972 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727349AbfGaPsC (ORCPT ); Wed, 31 Jul 2019 11:48:02 -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 D13F2AF9A; Wed, 31 Jul 2019 15:48:00 +0000 (UTC) From: Nicolas Saenz Julienne To: 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 Cc: 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, nsaenzjulienne@suse.de, akpm@linux-foundation.org, frowand.list@gmail.com, m.szyprowski@samsung.com, linux-rpi-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org Subject: [PATCH 0/8] Raspberry Pi 4 DMA addressing support Date: Wed, 31 Jul 2019 17:47:43 +0200 Message-Id: <20190731154752.16557-1-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.22.0 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 Hi all, this series attempts to address some issues we found while bringing up the new Raspberry Pi 4 in arm64 and it's intended to serve as a follow up of this discussion: https://lkml.org/lkml/2019/7/17/476 The new Raspberry Pi 4 has up to 4GB of memory but most peripherals can only address the first GB: their DMA address range is 0xc0000000-0xfc000000 which is aliased to the first GB of physical memory 0x00000000-0x3c000000. Note that only some peripherals have these limitations: the ARM cores, PCIe, V3D, GENET, and 40-bit DMA channels have a wider view of the address space. Part of this is solved in arm32 by setting up the machine specific '.dma_zone_size = SZ_1G', which takes care of the allocating the coherent memory area at the right spot. Yet no buffer bouncing (needed for dma streaming) is available at the moment, but that's a story for another series. Unfortunately there is no such thing as '.dma_zone_size' in arm64 also only ZONE_DMA32 is created which is interpreted by dma-direct and the arm64 code as if all peripherals where be able to address the first 4GB of memory. In the light of this, the series implements the following changes: - Add code that parses the device-tree in oder to find the SoC's common DMA area. - Create a ZONE_DMA whenever that area is needed and add the rest of the lower 4 GB of memory to ZONE_DMA32*. - Create the CMA area in a place suitable for all peripherals. - Inform dma-direct of the new runtime calculated min_mask*. That's all. Regards, Nicolas * These solutions where already discussed on the previous RFC (see link above). --- Nicolas Saenz Julienne (8): arm64: mm: use arm64_dma_phys_limit instead of calling max_zone_dma_phys() arm64: rename variables used to calculate ZONE_DMA32's size of/fdt: add function to get the SoC wide DMA addressable memory size arm64: re-introduce max_zone_dma_phys() arm64: use ZONE_DMA on DMA addressing limited devices dma-direct: turn ARCH_ZONE_DMA_BITS into a variable arm64: update arch_zone_dma_bits to fine tune dma-direct min mask mm: comment arm64's usage of 'enum zone_type' arch/arm64/Kconfig | 4 ++ arch/arm64/mm/init.c | 78 ++++++++++++++++++++++++++------- arch/powerpc/include/asm/page.h | 9 ---- arch/powerpc/mm/mem.c | 14 +++++- arch/s390/include/asm/page.h | 2 - arch/s390/mm/init.c | 1 + drivers/of/fdt.c | 72 ++++++++++++++++++++++++++++++ include/linux/dma-direct.h | 2 + include/linux/mmzone.h | 21 ++++----- include/linux/of_fdt.h | 2 + kernel/dma/direct.c | 8 ++-- 11 files changed, 168 insertions(+), 45 deletions(-) -- 2.22.0