From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: hch@infradead.org, mbrugger@suse.com, f.fainelli@gmail.com,
wahrenst@gmx.net, Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Russell King <linux@armlinux.org.uk>
Subject: [PATCH RFC 3/5] ARM: let machines select dma-direct over arch's DMA implementation
Date: Mon, 14 Oct 2019 20:31:05 +0200 [thread overview]
Message-ID: <20191014183108.24804-4-nsaenzjulienne@suse.de> (raw)
In-Reply-To: <20191014183108.24804-1-nsaenzjulienne@suse.de>
A bounce buffering feature is already available in ARM, dmabounce.c, yet
it doesn't support high memory which some devices need. Instead of
fixing it, provide a means for devices to enable dma-direct, which is the
preferred way of doing DMA now days.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
arch/arm/include/asm/mach/arch.h | 1 +
arch/arm/mm/init.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index e7df5a822cab..3542bf502573 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -33,6 +33,7 @@ struct machine_desc {
#ifdef CONFIG_ZONE_DMA
phys_addr_t dma_zone_size; /* size of DMA-able area */
#endif
+ bool dma_direct;
unsigned int video_start; /* start of video RAM */
unsigned int video_end; /* end of video RAM */
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 0a63379a4d1a..556f70665353 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -19,6 +19,7 @@
#include <linux/gfp.h>
#include <linux/memblock.h>
#include <linux/dma-contiguous.h>
+#include <linux/dma-direct.h>
#include <linux/sizes.h>
#include <linux/stop_machine.h>
#include <linux/swiotlb.h>
@@ -119,6 +120,8 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
*/
if (IS_ENABLED(CONFIG_ARM_LPAE))
arm_dma_direct = true;
+ else
+ arm_dma_direct = mdesc->dma_direct;
#ifdef CONFIG_ZONE_DMA
if (mdesc->dma_zone_size) {
@@ -126,7 +129,10 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
} else
arm_dma_limit = 0xffffffff;
+
arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
+
+ zone_dma_bits = ilog2(arm_dma_limit) + 1;
#endif
}
@@ -482,7 +488,7 @@ static void __init free_highpages(void)
*/
void __init mem_init(void)
{
-#ifdef CONFIG_ARM_LPAE
+#ifdef CONFIG_SWIOTLB
swiotlb_init(1);
#endif
--
2.23.0
next prev parent reply other threads:[~2019-10-14 18:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 18:31 [PATCH RFC 0/5] ARM: Raspberry Pi 4 DMA support Nicolas Saenz Julienne
2019-10-14 18:31 ` [PATCH RFC 1/5] dma/direct: turn ARCH_ZONE_DMA_BITS into a variable Nicolas Saenz Julienne
2019-10-30 21:49 ` Christoph Hellwig
2019-10-31 10:30 ` Nicolas Saenz Julienne
2019-10-31 13:38 ` Christoph Hellwig
2019-10-31 17:26 ` Nicolas Saenz Julienne
2019-10-14 18:31 ` [PATCH RFC 2/5] ARM: introduce arm_dma_direct Nicolas Saenz Julienne
2019-10-15 10:04 ` Christoph Hellwig
2019-10-14 18:31 ` Nicolas Saenz Julienne [this message]
2019-10-14 18:31 ` [PATCH RFC 4/5] dma/direct: check for overflows in ARM's dma_capable() Nicolas Saenz Julienne
2019-10-15 10:23 ` Christoph Hellwig
2019-10-15 13:07 ` Nicolas Saenz Julienne
2019-10-14 18:31 ` [PATCH RFC 5/5] ARM: bcm2711: use dma-direct Nicolas Saenz Julienne
2019-10-14 20:59 ` [PATCH RFC 0/5] ARM: Raspberry Pi 4 DMA support Catalin Marinas
2019-10-15 7:48 ` Nicolas Saenz Julienne
2019-10-15 17:46 ` Catalin Marinas
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=20191014183108.24804-4-nsaenzjulienne@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=f.fainelli@gmail.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mbrugger@suse.com \
--cc=robin.murphy@arm.com \
--cc=wahrenst@gmx.net \
/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).