JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit bb0e391975f8da826305cbaa3e3d34b03c47e2a6
Author: Christoph Hellwig <hch@lst.de>
Date: Sun Sep 22 09:10:17 2024 +0200
dma-mapping: fix vmap and mmap of noncontiougs allocations
Commit b5c58b2fdc42 ("dma-mapping: direct calls for dma-iommu") switched
to use direct calls to dma-iommu, but missed the dma_vmap_noncontiguous,
dma_vunmap_noncontiguous and dma_mmap_noncontiguous behavior keyed off the
presence of the alloc_noncontiguous method.
Fix this by removing the now unused alloc_noncontiguous and
free_noncontiguous methods and moving the vmapping and mmaping of the
noncontiguous allocations into the iommu code, as it is the only provider
of actually noncontiguous allocations.
Fixes: b5c58b2fdc42 ("dma-mapping: direct calls for dma-iommu")
Reported-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Leon Romanovsky <leon@kernel.org>
Tested-by: Xi Ruoyao <xry111@xry111.site>
(cherry picked from commit bb0e391975f8da826305cbaa3e3d34b03c47e2a6)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit a5fb217f13f74b2af2ab366ffad522bae717f93c
Author: Christoph Hellwig <hch@lst.de>
Date: Thu Sep 12 09:21:18 2024 +0200
dma-mapping: reflow dma_supported
dma_supported has become too much spaghetti for my taste. Reflow it to
remove the duplicate use_dma_iommu condition and make the main path more
obvious.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Leon Romanovsky <leon@kernel.org>
(cherry picked from commit a5fb217f13f74b2af2ab366ffad522bae717f93c)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit f45cfab28fcd5ac67a38750b6c68316b26d35ac8
Author: Leon Romanovsky <leon@kernel.org>
Date: Wed Sep 11 13:15:00 2024 +0300
dma-mapping: reliably inform about DMA support for IOMMU
If the DMA IOMMU path is going to be used, the appropriate check should
return that DMA is supported.
Fixes: b5c58b2fdc42 ("dma-mapping: direct calls for dma-iommu")
Closes: https://lore.kernel.org/all/181e06ff-35a3-434f-b505-672f430bd1cb@notapiano
Reported-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> #KernelCI
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit f45cfab28fcd5ac67a38750b6c68316b26d35ac8)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Conflicts: __assign_str takes 2 arguments. 2c92ca849fcc ("tracing/treewide: Remove second parameter of __assign_str()")
not backported yet.
commit 038eb433dc1474c4bc7d33188294e3d4778efdfd
Author: Sean Anderson <sean.anderson@linux.dev>
Date: Fri Sep 6 17:54:34 2024 -0400
dma-mapping: add tracing for dma-mapping API calls
When debugging drivers, it can often be useful to trace when memory gets
(un)mapped for DMA (and can be accessed by the device). Add some
tracepoints for this purpose.
Use u64 instead of phys_addr_t and dma_addr_t (and similarly %llx instead
of %pa) because libtraceevent can't handle typedefs in all cases.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 038eb433dc1474c4bc7d33188294e3d4778efdfd)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Conflicts: Context diff due to IA64 removal commits not being backported to RHEL
commit b5c58b2fdc427e7958412ecb2de2804a1f7c1572
Author: Leon Romanovsky <leon@kernel.org>
Date: Wed Jul 24 21:04:49 2024 +0300
dma-mapping: direct calls for dma-iommu
Directly call into dma-iommu just like we have been doing for dma-direct
for a while. This avoids the indirect call overhead for IOMMU ops and
removes the need to have DMA ops entirely for many common configurations.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit b5c58b2fdc427e7958412ecb2de2804a1f7c1572)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-61942
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit f69e342eec008e1bab772d3963c3dd9979293e13
Author: Leon Romanovsky <leon@kernel.org>
Date: Wed Jul 24 21:04:48 2024 +0300
dma-mapping: call ->unmap_page and ->unmap_sg unconditionally
Almost all instances of the dma_map_ops ->map_page()/map_sg() methods
implement ->unmap_page()/unmap_sg() too. The once instance which doesn't
dma_dummy_ops which is used to fail the DMA mapping and thus there won't
be any calls to ->unmap_page()/unmap_sg().
Remove the checks for ->unmap_page()/unmap_sg() and call them directly to
create an interface that is symmetrical to ->map_page()/map_sg().
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit f69e342eec008e1bab772d3963c3dd9979293e13)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5113
# Merge Request Required Information
JIRA: https://issues.redhat.com/browse/RHEL-36247
JIRA: https://issues.redhat.com/browse/RHEL-54186
JIRA: https://issues.redhat.com/browse/RHEL-54189
JIRA: https://issues.redhat.com/browse/RHEL-55199
JIRA: https://issues.redhat.com/browse/RHEL-55200
JIRA: https://issues.redhat.com/browse/RHEL-55448
JIRA: https://issues.redhat.com/browse/RHEL-55450
JIRA: https://issues.redhat.com/browse/RHEL-55466
JIRA: https://issues.redhat.com/browse/RHEL-57229
Upstream: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
CVE: CVE-2024-44994
## Summary of Changes
This brings the IOMMU and DMA api subsystems in line with v6.11. Overall it is smaller than normal, but I expect there will be another MR later on with some things landing in v6.12. In addition to the usual fixes, and cleanups the major changes are:
- iommufd io page fault support
- smmuv3 dirty page tracking support
- vt-d cache tagging support
- iommu memory usage observability support
- Some cleanups from Robin related to dma range calculation, arch setup_dma_ops, and iommu_fwspec_ops
- Another batch of updates to smmuv3 from Jason's reworking of the driver (2b/3)
There also is a rhel only cleanup to deal with a cleanup in the iommufd code by Linus in one of merges that was related to some mm changes at the time, but wasn't dealt with when the iommufd or mm changes were merged to rhel.
Testing:
- kernel-tests iommu new-boot testing
- kernel-tests iommu fio testing
- kernel-tests dmatest and idxd tests
- iommufd kernel selftest
- general cki testing
v5: Added 3 fixes that recently landed upstream.
v6: Resolve issues raised by Don:
- Conflicts note updates
- Backport of acpi, and arm7 io-pgtable commit.
- While doing this I went through to diff against upstream and cleaned up a couple more merge commit cleanups:
* __GFP_ZERO use in amd ppr log alloc code.
* Line break in swiotlb code.
* dead config option in drivers/iommu/intel/Kconfig
- Hyperv commit that was missed in previous backports.
v7: Fixed typo from using Conflict instead of Conflicts for tag.
v8: Fixed borked conflict resolution after adding acpi patch in v6.
v10: Added dt bindings commit mentioned by Eric.
v11: Rebase due to merge conflict after acpi MR merged. This also drops a couple acpi commits that were now empty.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
## Approved Development Ticket
All submissions to CentOS Stream must reference an approved ticket in [Red Hat Jira](https://issues.redhat.com/). Please follow the CentOS Stream [contribution documentation](https://docs.centos.org/en-US/stream-contrib/quickstart/) for how to file this ticket and have it approved.
Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com>
Approved-by: Mark Salter <msalter@redhat.com>
Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Approved-by: Donald Dutile <ddutile@redhat.com>
Approved-by: Steve Best <sbest@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>
Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-54751
CVE: CVE-2024-43856
commit 28e8b7406d3a1f5329a03aa25a43aa28e087cb20
Author: Lance Richardson <rlance@google.com>
Date: Thu Jul 18 14:38:24 2024 +0000
dma: fix call order in dmam_free_coherent
dmam_free_coherent() frees a DMA allocation, which makes the
freed vaddr available for reuse, then calls devres_destroy()
to remove and free the data structure used to track the DMA
allocation. Between the two calls, it is possible for a
concurrent task to make an allocation with the same vaddr
and add it to the devres list.
If this happens, there will be two entries in the devres list
with the same vaddr and devres_destroy() can free the wrong
entry, triggering the WARN_ON() in dmam_match.
Fix by destroying the devres entry before freeing the DMA
allocation.
Tested:
kokonut //net/encryption
http://sponge2/b9145fe6-0f72-4325-ac2f-a84d81075b03
Fixes: 9ac7849e35 ("devres: device resource management")
Signed-off-by: Lance Richardson <rlance@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eder Zulian <ezulian@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-55466
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Conflicts: Dropped unsupported bits.
commit 8a2f11878771da65b8ac135c73b47dae13afbd62
Author: Suren Baghdasaryan <surenb@google.com>
Date: Thu Mar 21 09:36:39 2024 -0700
change alloc_pages name in dma_map_ops to avoid name conflicts
After redefining alloc_pages, all uses of that name are being replaced.
Change the conflicting names to prevent preprocessor from replacing them
when it's not intended.
Link: https://lkml.kernel.org/r/20240321163705.3067592-18-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Tested-by: Kees Cook <keescook@chromium.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Alex Gaynor <alex.gaynor@gmail.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andreas Hindborg <a.hindborg@samsung.com>
Cc: Benno Lossin <benno.lossin@proton.me>
Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 8a2f11878771da65b8ac135c73b47dae13afbd62)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-44835
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit a6016aac5252da9d22a4dc0b98121b0acdf6d2f5
Author: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Thu May 9 16:46:16 2024 +0200
dma: fix DMA sync for drivers not calling dma_set_mask*()
There are several reports that the DMA sync shortcut broke non-coherent
devices.
dev->dma_need_sync is false after the &device allocation and if a driver
didn't call dma_set_mask*(), it will still be false even if the device
is not DMA-coherent and thus needs synchronizing. Due to historical
reasons, there's still a lot of drivers not calling it.
Invert the boolean, so that the sync will be performed by default and
the shortcut will be enabled only when calling dma_set_mask*().
Reported-by: Steven Price <steven.price@arm.com>
Closes: https://lore.kernel.org/lkml/010686f5-3049-46a1-8230-7752a1b433ff@arm.com
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/lkml/46160534-5003-4809-a408-6b3a3f4921e9@samsung.com
Fixes: f406c8e4b770. ("dma: avoid redundant calls for sync operations")
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Steven Price <steven.price@arm.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
(cherry picked from commit a6016aac5252da9d22a4dc0b98121b0acdf6d2f5)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-44835
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit f406c8e4b770ca3b0df84a17349e13f2b6b07d10
Author: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Tue May 7 13:20:21 2024 +0200
dma: avoid redundant calls for sync operations
Quite often, devices do not need dma_sync operations on x86_64 at least.
Indeed, when dev_is_dma_coherent(dev) is true and
dev_use_swiotlb(dev) is false, iommu_dma_sync_single_for_cpu()
and friends do nothing.
However, indirectly calling them when CONFIG_RETPOLINE=y consumes about
10% of cycles on a cpu receiving packets from softirq at ~100Gbit rate.
Even if/when CONFIG_RETPOLINE is not set, there is a cost of about 3%.
Add dev->need_dma_sync boolean and turn it off during the device
initialization (dma_set_mask()) depending on the setup:
dev_is_dma_coherent() for the direct DMA, !(sync_single_for_device ||
sync_single_for_cpu) or the new dma_map_ops flag, %DMA_F_CAN_SKIP_SYNC,
advertised for non-NULL DMA ops.
Then later, if/when swiotlb is used for the first time, the flag
is reset back to on, from swiotlb_tbl_map_single().
On iavf, the UDP trafficgen with XDP_DROP in skb mode test shows
+3-5% increase for direct DMA.
Suggested-by: Christoph Hellwig <hch@lst.de> # direct DMA shortcut
Co-developed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit f406c8e4b770ca3b0df84a17349e13f2b6b07d10)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-44835
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit fe7514b149e0a8a6f3031d286e52d40163b0b11a
Author: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Tue May 7 13:20:20 2024 +0200
dma: compile-out DMA sync op calls when not used
Some platforms do have DMA, but DMA there is always direct and coherent.
Currently, even on such platforms DMA sync operations are compiled and
called.
Add a new hidden Kconfig symbol, DMA_NEED_SYNC, and set it only when
either sync operations are needed or there is DMA ops or swiotlb
or DMA debug is enabled. Compile global dma_sync_*() and dma_need_sync()
only when it's set, otherwise provide empty inline stubs.
The change allows for future optimizations of DMA sync calls depending
on runtime conditions.
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit fe7514b149e0a8a6f3031d286e52d40163b0b11a)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-28780
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit a409d9600959f3c4b2a48946304c8e01b8d04072
Author: Jia He <justin.he@arm.com>
Date: Sat Oct 28 10:20:59 2023 +0000
dma-mapping: fix dma_addressing_limited() if dma_range_map can't cover all system RAM
There is an unusual case that the range map covers right up to the top
of system RAM, but leaves a hole somewhere lower down. Then it prevents
the nvme device dma mapping in the checking path of phys_to_dma() and
causes the hangs at boot.
E.g. On an Armv8 Ampere server, the dsdt ACPI table is:
Method (_DMA, 0, Serialized) // _DMA: Direct Memory Access
{
Name (RBUF, ResourceTemplate ()
{
QWordMemory (ResourceConsumer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
0x0000000000000000, // Granularity
0x0000000000000000, // Range Minimum
0x00000000FFFFFFFF, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000000100000000, // Length
,, , AddressRangeMemory, TypeStatic)
QWordMemory (ResourceConsumer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
0x0000000000000000, // Granularity
0x0000006010200000, // Range Minimum
0x000000602FFFFFFF, // Range Maximum
0x0000000000000000, // Translation Offset
0x000000001FE00000, // Length
,, , AddressRangeMemory, TypeStatic)
QWordMemory (ResourceConsumer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
0x0000000000000000, // Granularity
0x00000060F0000000, // Range Minimum
0x00000060FFFFFFFF, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000000010000000, // Length
,, , AddressRangeMemory, TypeStatic)
QWordMemory (ResourceConsumer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
0x0000000000000000, // Granularity
0x0000007000000000, // Range Minimum
0x000003FFFFFFFFFF, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000039000000000, // Length
,, , AddressRangeMemory, TypeStatic)
})
But the System RAM ranges are:
cat /proc/iomem |grep -i ram
90000000-91ffffff : System RAM
92900000-fffbffff : System RAM
880000000-fffffffff : System RAM
8800000000-bff5990fff : System RAM
bff59d0000-bff5a4ffff : System RAM
bff8000000-bfffffffff : System RAM
So some RAM ranges are out of dma_range_map.
Fix it by checking whether each of the system RAM resources can be
properly encompassed within the dma_range_map.
Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit a409d9600959f3c4b2a48946304c8e01b8d04072)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-28780
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 8ae0e970319ac0b516d285650a744bab4ed3dd37
Author: Jia He <justin.he@arm.com>
Date: Sat Oct 28 10:20:58 2023 +0000
dma-mapping: move dma_addressing_limited() out of line
This patch moves dma_addressing_limited() out of line, serving as a
preliminary step to prevent the introduction of a new publicly accessible
low-level helper when validating whether all system RAM is mapped within
the DMA mapping range.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 8ae0e970319ac0b516d285650a744bab4ed3dd37)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-10094
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 3d6f126b15d9fd8435455fffc912d976973a7a09
Author: Arnd Bergmann <arnd@arndb.de>
Date: Thu Jul 27 14:25:42 2023 +0200
dma-mapping: move arch_dma_set_mask() declaration to header
This function has a __weak definition and an override that is only used on
freescale powerpc chips. The powerpc definition however does not see the
declaration that is in a .c file:
arch/powerpc/kernel/dma-mask.c:7:6: error: no previous prototype for 'arch_dma_set_mask' [-Werror=missing-prototypes]
Move it into the linux/dma-map-ops.h header where the other arch_dma_* functions
are declared.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 3d6f126b15d9fd8435455fffc912d976973a7a09)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-10094
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 1d3f56b295302fdb4ac9caf6ce09f5ae7d2e651a
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date: Sat Apr 1 10:15:30 2023 +0100
dma-mapping: provide CONFIG_ARCH_DMA_DEFAULT_COHERENT
Provide a kconfig option to allow arches to manipulate default
value of dma_default_coherent in Kconfig.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 1d3f56b295302fdb4ac9caf6ce09f5ae7d2e651a)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-10094
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit fe4e5efa401fe15eab9259e358730145449e83a2
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date: Sat Apr 1 10:15:29 2023 +0100
dma-mapping: provide a fallback dma_default_coherent
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c
but only decleared when any of non-coherent options is enabled in
dma-map-ops.h.
Guard the declaration in mapping.c with non-coherent options and provide
a fallback definition.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit fe4e5efa401fe15eab9259e358730145449e83a2)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-2542
Upstream Status: RHEL Only
This reverts commit a2cfbf05cd.
bnx2i/cnic currently fails to properly mmap its dma_alloc_coherent
buffers through a uio interface without being able to allocate compound
pages. Revert this until we can get a better cnic fix.
Signed-off-by: Chris Leech <cleech@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2181354
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit ffcb754584603adf7039d7972564fbf6febdc542
Author: Christoph Hellwig <hch@lst.de>
Date: Wed Nov 9 08:37:17 2022 +0100
dma-mapping: reject __GFP_COMP in dma_alloc_attrs
DMA allocations can never be turned back into a page pointer, so
requesting compound pages doesn't make sense and it can't even be
supported at all by various backends.
Reject __GFP_COMP with a warning in dma_alloc_attrs, and stop clearing
the flag in the arm dma ops and dma-iommu.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
(cherry picked from commit ffcb754584603adf7039d7972564fbf6febdc542)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2181354
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 3622b86f49f84e52fb41fee9eb55f9290613dfc3
Author: Christoph Hellwig <hch@lst.de>
Date: Tue Dec 20 09:08:12 2022 +0100
dma-mapping: reject GFP_COMP for noncoherent allocations
While not quite as bogus as for the dma-coherent allocations that were
fixed earlier, GFP_COMP for these allocations has no benefits for
the dma-direct case, and can't be supported at all by dma dma-iommu
backend which splits up allocations into smaller orders. Due to an
oversight in ffcb75458460 that flag stopped being cleared for all
dma allocations, but only got rejected for coherent ones, so fix up
these callers to not allow __GFP_COMP as well after the sound code
has been fixed to not ask for it.
Fixes: ffcb75458460 ("dma-mapping: reject __GFP_COMP in dma_alloc_attrs")
Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit 3622b86f49f84e52fb41fee9eb55f9290613dfc3)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2112024
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 9fc18f6d56d5b79d527c17a8100a0965d18345cf
Author: Christoph Hellwig <hch@lst.de>
Date: Sun Aug 21 16:06:44 2022 +0200
dma-mapping: mark dma_supported static
Now that the remaining users in drivers are gone, this function can be
marked static.
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 9fc18f6d56d5b79d527c17a8100a0965d18345cf)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2112024
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 8419702489f3be7f9e4fcf12c04d9d3f00114d35
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Wed Jul 27 13:15:22 2022 -0600
dma-mapping: reformat comment to suppress htmldoc warning
make html doc reports a cryptic warning with the commit named below:
kernel/dma/mapping.c:258: WARNING: Option list ends without a blank
line; unexpected unindent.
Seems the parser is a bit fussy about the tabbing and having a single
space tab causes the warning. To suppress the warning add another
tab to the list and reindent everything.
Fixes: 7c2645a2a30a ("dma-mapping: allow EREMOTEIO return code for P2PDMA transfers")
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 8419702489f3be7f9e4fcf12c04d9d3f00114d35)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2112024
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 159bf19270e80b5bc4b13aa88072dcb390b4d297
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Fri Jul 8 10:50:57 2022 -0600
dma-mapping: add flags to dma_map_ops to indicate PCI P2PDMA support
Add a flags member to the dma_map_ops structure with one flag to
indicate support for PCI P2PDMA.
Also, add a helper to check if a device supports PCI P2PDMA.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 159bf19270e80b5bc4b13aa88072dcb390b4d297)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2112024
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit 7c2645a2a30a45d3dc4c98b315a51be44ec69a67
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Fri Jul 8 10:50:55 2022 -0600
dma-mapping: allow EREMOTEIO return code for P2PDMA transfers
Add EREMOTEIO error return to dma_map_sgtable() which will be used
by .map_sg() implementations that detect P2PDMA pages that the
underlying DMA device cannot access.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 7c2645a2a30a45d3dc4c98b315a51be44ec69a67)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2112024
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
commit a229cc14f3395311b899e5e582b71efa8dd01df0
Author: John Garry <john.garry@huawei.com>
Date: Thu Jul 14 19:15:24 2022 +0800
dma-mapping: add dma_opt_mapping_size()
Streaming DMA mapping involving an IOMMU may be much slower for larger
total mapping size. This is because every IOMMU DMA mapping requires an
IOVA to be allocated and freed. IOVA sizes above a certain limit are not
cached, which can have a big impact on DMA mapping performance.
Provide an API for device drivers to know this "optimal" limit, such that
they may try to produce mapping which don't exceed it.
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit a229cc14f3395311b899e5e582b71efa8dd01df0)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2072170
Upstream Status: kernel/git/torvalds/linux.git
commit 4fe87e818ea492ade079cc01a31d088e445f8539
Author: Christoph Hellwig <hch@lst.de>
Date: Thu Mar 31 08:01:21 2022 +0200
dma-mapping: move pgprot_decrypted out of dma_pgprot
pgprot_decrypted is used by AMD SME systems to allow access to memory
that was set to not encrypted using set_memory_decrypted. That only
happens for dma-direct memory as the IOMMU solves the addressing
challenges for the encryption bit using its own remapping.
Move the pgprot_decrypted call out of dma_pgprot which is also used
by the IOMMU mappings and into dma-direct so that it is only used with
memory that was set decrypted.
Fixes: f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP")
Reported-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
(cherry picked from commit 4fe87e818ea492ade079cc01a31d088e445f8539)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2072170
Upstream Status: kernel/git/torvalds/linux.git
commit a9c38c5d267cb94871dfa2de5539c92025c855d7
Author: Mike Rapoport <rppt@linux.ibm.com>
Date: Thu Sep 30 04:30:38 2021 +0300
dma-mapping: remove bogus test for pfn_valid from dma_map_resource
dma_map_resource() uses pfn_valid() to ensure the range is not RAM.
However, pfn_valid() only checks for availability of the memory map for a
PFN but it does not ensure that the PFN is actually backed by RAM.
As dma_map_resource() is the only method in DMA mapping APIs that has this
check, simply drop the pfn_valid() test from dma_map_resource().
Link: https://lore.kernel.org/all/20210824173741.GC623@arm.com/
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20210930013039.11260-2-rppt@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit a9c38c5d267cb94871dfa2de5539c92025c855d7)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit c2bbf9d1e9ac7d4fdd503b190bc1ba8a6302bc49
Author: Hamza Mahfooz <someguy@effective-light.com>
Date: Tue Oct 12 01:54:03 2021 -0400
dma-debug: teach add_dma_entry() about DMA_ATTR_SKIP_CPU_SYNC
Mapping something twice should be possible as long as,
DMA_ATTR_SKIP_CPU_SYNC is passed to the strictly speaking second relevant
mapping operation (that attempts to map the same thing). So, don't issue a
warning if the specified condition is met in add_dma_entry().
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit c2bbf9d1e9ac7d4fdd503b190bc1ba8a6302bc49)
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit 011a9ce80763141e7fa613934e76bef8948e4a4f
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Tue Oct 5 10:48:12 2021 -0600
dma-mapping: fix the kerneldoc for dma_map_sgtable()
htmldocs began producing the following warnings:
kernel/dma/mapping.c:256: WARNING: Definition list ends without a
blank line; unexpected unindent.
kernel/dma/mapping.c:257: WARNING: Bullet list ends without a blank
line; unexpected unindent.
Reformatting the list without hyphens fixes the warnings and produces
both a readable text and HTML output.
Fixes: fffe3cc8c219 ("dma-mapping: allow map_sg() ops to return negative error code")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 011a9ce80763141e7fa613934e76bef8948e4a4f)
Cc: Myron Stowe <myron.stowe@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit a61cb6017df0a9be072a35259e6e9ae7aa0ef6b3
Author: Christoph Hellwig <hch@lst.de>
Date: Mon Sep 6 14:40:00 2021 +0200
dma-mapping: fix the kerneldoc for dma_map_sg_attrs
Add the missing description for the nents parameter, and fix a trivial
misalignment.
Fixes: fffe3cc8c219 ("dma-mapping: allow map_sg() ops to return negative error codes")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit a61cb6017df0a9be072a35259e6e9ae7aa0ef6b3)
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit 2a047e0662aee1bd773e0415accd785ad26a9398
Author: Christoph Hellwig <hch@lst.de>
Date: Mon Aug 9 17:19:36 2021 +0200
dma-mapping: return an unsigned int from dma_map_sg{,_attrs}
These can only return 0 for failure or the number of entries, so turn
the return value into an unsigned int.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
(cherry picked from commit 2a047e0662aee1bd773e0415accd785ad26a9398)
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit d03c54419274f96434e2ad74e59e67ec6d54ca86
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Mon Aug 9 17:13:31 2021 +0200
dma-mapping: disallow .map_sg operations from returning zero on error
Now that all the .map_sg operations have been converted to returning
proper error codes, drop the code to handle a zero return value,
add a warning if a zero is returned.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit d03c54419274f96434e2ad74e59e67ec6d54ca86)
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2004348
Upstream Status: kernel/git/torvalds/linux.git
commit fffe3cc8c2194f60c4af4fac7f27d25e8828f001
Author: Logan Gunthorpe <logang@deltatee.com>
Date: Thu Jul 29 14:15:19 2021 -0600
dma-mapping: allow map_sg() ops to return negative error codes
Allow dma_map_sgtable() to pass errors from the map_sg() ops. This
will be required for returning appropriate error codes when mapping
P2PDMA memory.
Introduce __dma_map_sg_attrs() which will return the raw error code
from the map_sg operation (whether it be negative or zero). Then add a
dma_map_sg_attrs() wrapper to convert any negative errors to zero to
satisfy the existing calling convention.
dma_map_sgtable() defines three error codes that .map_sg implementations
are allowed to return: -EINVAL, -ENOMEM and -EIO. The latter of which
is a generic return for cases that are passing DMA_MAPPING_ERROR
through.
dma_map_sgtable() will convert a zero error return for old map_sg() ops
into a -EIO return and return any negative errors as reported.
This allows map_sg implementations to start returning multiple
negative error codes. Legacy map_sg implementations can continue
to return zero until they are all converted.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit fffe3cc8c2194f60c4af4fac7f27d25e8828f001)
Cc: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Add a new API that returns a potentiall virtually non-contigous sg_table
and a DMA address. This API is only properly implemented for dma-iommu
and will simply return a contigious chunk as a fallback.
The intent is that drivers can use this API if either:
- no kernel mapping or only temporary kernel mappings are required.
That is as a better replacement for DMA_ATTR_NO_KERNEL_MAPPING
- a kernel mapping is required for cached and DMA mapped pages, but
the driver also needs the pages to e.g. map them to userspace.
In that sense it is a replacement for some aspects of the recently
removed and never fully implemented DMA_ATTR_NON_CONSISTENT
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
Factour out internal versions without the dma_debug calls in preparation
for callers that will need different dma_debug calls.
Note that this changes the dma_debug calls to get the not page aligned
size values, but as long as alloc and free agree on one variant we are
fine.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
Add a helper to map memory allocated using dma_alloc_pages into
a user address space, similar to the dma_alloc_attrs function for
coherent allocations.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
- add support to emulate processing delays in the DMA API benchmark
selftest (Barry Song)
- remove support for non-contiguous noncoherent allocations,
which aren't used and will be replaced by a different API
-----BEGIN PGP SIGNATURE-----
iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmA2A7gLHGhjaEBsc3Qu
ZGUACgkQD55TZVIEUYMebw//bkSZ1v1FvGgMd+AQKKnNz+iNHH0MJAlEDhPCynFM
QCPg6OtU9IU/5nmyQlO3rgZ1IW+qABCF36TqjPZar6STuTv3dzfvv9xydyOqdPNA
ekFzc9FnjvWt4wzL+1pXiB/EfjKDudGAjlMyLhghl653HcLnLvE3LxgpfBMrUHbH
DfSBTXt4fTK4ck8ZO6FW2LXOtLgmJvk+qglO1vs9GQv/zcRHXYkIyvqMYTlHwBlh
Ltfl+kJzFHQ3taIo3utCeS5Qzctd6tbxy/Me4OHl2VydNAi8awQz4HX4yZyWYxl5
WpIGhHfD9ROKnGroaEhetUO4OczOXiqYdkt6tt5iAAUW2TFA+mgbvph3+Di/zxgl
4IxOQyhdWA38IA00YmNsoPafuuqC7WwASUfCufg+30MgHR3bpM7GyY5X84DIh3tm
wlPJBMl2RqWnfxmmvjPYxV2wtN3TkA8KJN/xVcUE8aWL2mV50l1/nDdlvCbmjg60
pQt1cGP8A2hODYwLHTzadm67xc0cLrkC8nQbrnDo/FAKGmDD3aHhS95TAIr+ZoeK
cgSFHNkJ1UcJ6nosCB3/MPlIJo1noAIeJnmuOIfhJn0uIof4CGQ5XQgWmJeHFLqO
GlwtJAN3F3db4dxMQNn5br049wob7fgFWqMPfTGy51bZ5BClUKWGSpEonavpUMd1
oKM=
=papz
-----END PGP SIGNATURE-----
Merge tag 'dma-mapping-5.12' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping updates from Christoph Hellwig:
- add support to emulate processing delays in the DMA API benchmark
selftest (Barry Song)
- remove support for non-contiguous noncoherent allocations, which
aren't used and will be replaced by a different API
* tag 'dma-mapping-5.12' of git://git.infradead.org/users/hch/dma-mapping:
dma-mapping: remove the {alloc,free}_noncoherent methods
dma-mapping: benchmark: pretend DMA is transmitting
Lift the dma_default_coherent variable from the mips architecture code
to the driver core. This allows an architecture to sdefault all device
to be DMA coherent at run time, even if the kernel is build with support
for DMA noncoherent device. By allowing device_initialize to set the
->dma_coherent field to this default the amount of arch hooks required
for this behavior can be greatly reduced.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
It turns out allowing non-contigous allocations here was a rather bad
idea, as we'll now need to define ways to get the pages for mmaping
or dma_buf sharing. Revert this change and stick to the original
concept. A different API for the use case of non-contigous allocations
will be added back later.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>:wq
At the moment we allow bypassing DMA ops only when we can do this for
the entire RAM. However there are configs with mixed type memory
where we could still allow bypassing IOMMU in most cases;
POWERPC with persistent memory is one example.
This adds an arch hook to determine where bypass can still work and
we invoke direct DMA API. The following patch checks the bus limit
on POWERPC to allow or disallow direct mapping.
This adds a ARCH_HAS_DMA_MAP_DIRECT config option to make the arch_xxxx
hooks no-op by default.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Most of the dma_direct symbols should only be used by direct.c and
mapping.c, so move them to kernel/dma. In fact more of dma-direct.h
should eventually move, but that will require more coordination with
other subsystems.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Most of dma-debug.h is not required by anything outside of kernel/dma.
Move the four declarations needed by dma-mappin.h or dma-ops providers
into dma-mapping.h and dma-map-ops.h, and move the remainder of the
file to kernel/dma/debug.h.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Split out all the bits that are purely for dma_map_ops implementations
and related code into a new <linux/dma-map-ops.h> header so that they
don't get pulled into all the drivers. That also means the architecture
specific <asm/dma-mapping.h> is not pulled in by <linux/dma-mapping.h>
any more, which leads to a missing includes that were pulled in by the
x86 or arm versions in a few not overly portable drivers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
This API is the equivalent of alloc_pages, except that the returned memory
is guaranteed to be DMA addressable by the passed in device. The
implementation will also be used to provide a more sensible replacement
for DMA_ATTR_NON_CONSISTENT flag.
Additionally dma_alloc_noncoherent is switched over to use dma_alloc_pages
as its backend.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> (MIPS part)