From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: linux-arm-kernel@lists.infradead.org,
Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>
Cc: stefan.wahren@i2se.com, f.fainelli@gmail.com,
catalin.marinas@arm.com, phil@raspberrypi.org,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Jisheng.Zhang@synaptics.com, mbrugger@suse.com, will@kernel.org,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Subject: [RFC 3/4] dma-direct: add dma_direct_min_mask
Date: Wed, 17 Jul 2019 17:31:34 +0200 [thread overview]
Message-ID: <20190717153135.15507-4-nsaenzjulienne@suse.de> (raw)
In-Reply-To: <20190717153135.15507-1-nsaenzjulienne@suse.de>
Historically devices with ZONE_DMA32 have been assumed to be able to
address at least the lower 4GB of ram for DMA. This is still the defualt
behavior yet the Raspberry Pi 4 is limited to the first GB of memory.
This has been observed to trigger failures in dma_direct_supported() as
the 'min_mask' isn't properly set.
We create 'dma_direct_min_mask' in order for the arch init code to be
able to fine-tune dma direct's 'min_dma' mask.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
kernel/dma/direct.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index b90e1aede743..3c8cd730648b 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -23,6 +23,8 @@
#define ARCH_ZONE_DMA_BITS 24
#endif
+u64 dma_direct_min_mask __ro_after_init = DMA_BIT_MASK(32);
+
/*
* For AMD SEV all DMA must be to unencrypted addresses.
*/
@@ -393,7 +395,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
if (IS_ENABLED(CONFIG_ZONE_DMA))
min_mask = DMA_BIT_MASK(ARCH_ZONE_DMA_BITS);
else
- min_mask = DMA_BIT_MASK(32);
+ min_mask = dma_direct_min_mask;
min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT);
--
2.22.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-07-17 15:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 15:31 [RFC 0/4] Raspberry Pi 4 DMA addressing support Nicolas Saenz Julienne
2019-07-17 15:31 ` Nicolas Saenz Julienne [this message]
2019-07-18 9:15 ` [RFC 3/4] dma-direct: add dma_direct_min_mask Christoph Hellwig
2019-07-18 11:18 ` Nicolas Saenz Julienne
2019-07-19 13:08 ` Nicolas Saenz Julienne
2019-07-24 13:51 ` Catalin Marinas
2019-07-24 13:56 ` Christoph Hellwig
2019-07-24 14:27 ` Nicolas Saenz Julienne
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=20190717153135.15507-4-nsaenzjulienne@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=Jisheng.Zhang@synaptics.com \
--cc=catalin.marinas@arm.com \
--cc=f.fainelli@gmail.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mbrugger@suse.com \
--cc=phil@raspberrypi.org \
--cc=robin.murphy@arm.com \
--cc=stefan.wahren@i2se.com \
--cc=will@kernel.org \
/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