History log of /src/sys/compat/linuxkpi/common/include/linux/dma-mapping.h (Results 1 – 25 of 81)
Revision Date Author Comments
# 31c3cba8 19-Feb-2026 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: pass attrs in more places in dma-mapping.h

Various macros (dma_map_sg_attrs, dma_unmap_sg_attrs,
dma_map_single_attrs, and dma_unmap_single_attrs) currently supress
passing on the attrs ar

LinuxKPI: pass attrs in more places in dma-mapping.h

Various macros (dma_map_sg_attrs, dma_unmap_sg_attrs,
dma_map_single_attrs, and dma_unmap_single_attrs) currently supress
passing on the attrs argument. Their implementation (even though at
times still marked the argument __unused; we remove that) have long
gained support for handling the argument.
With ofed fixed (5edf24aac1d09), pass the argument through so that
other drivers using these functions may hopefully work just a bit
better as well.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D55391

show more ...


# 0a575891 21-Jan-2026 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: implement dmam_free_coherent()

dmam_free_coherent() is used by an updated mt76 driver at v6.19-rc6.
We need to surgically find the devres information and destroy it before
calling dma_free

LinuxKPI: implement dmam_free_coherent()

dmam_free_coherent() is used by an updated mt76 driver at v6.19-rc6.
We need to surgically find the devres information and destroy it before
calling dma_free_coherent.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D54810

show more ...


# a02180cf 01-Apr-2025 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: Implement dma_map_resource/dma_unmap_resource functions

dma_map_resource() and dma_unmap_resource() functions are used to map
and unmap of memory-mapped IO resources so they can be accesse

LinuxKPI: Implement dma_map_resource/dma_unmap_resource functions

dma_map_resource() and dma_unmap_resource() functions are used to map
and unmap of memory-mapped IO resources so they can be accessed by
the device.

Required by drm-kmod v5.5 to be built.

While for drm-kmod 6.6-lts only amdgpu uses these in one place and
the code apparently has not been exercised a lot it has been around
like this for years. With changing the underlying implementations
bring it into the tree; should we find errors with it they can also
be fixed here.

Bump __FreeBSD version to be able to detect this change.

Obtained from: D30933 (by wulf)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D49625

show more ...


# f99d393f 21-May-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add missing bus_dmamap_sync() calls or exclude them

Rename linux_dma_unmap() to lkpi_dma_unmap(), and linux_dma_map_phys()
to lkpi_dma_map_phys() so that we get the full set of function
ar

LinuxKPI: add missing bus_dmamap_sync() calls or exclude them

Rename linux_dma_unmap() to lkpi_dma_unmap(), and linux_dma_map_phys()
to lkpi_dma_map_phys() so that we get the full set of function
arguments (direction and attributes were missing).
Leave the old functions as wrappers as they are called from drm-kmod
linuxkpi/bsd still, and leaving them also allows us to MFC this
change.

Add missing bus_dmamap_sync() calls. Rather than inlining them
in each inline function push them down to the actual implementation.
From there do not inline them either but call the appropriate
function dealing with the sync so that we do not have the same
code splattered in many places.

Adhere to the DMA_ATTR_SKIP_CPU_SYNC attribute and skip synching
when requested.

A previous, less complete version of this change already allowed
me to load firmware on arm64 for iwlwifi (again).

There are four more places which are not currently done as the
functions which came with an OFED sync a long time ago seem to be
unused these days. Leaving a pr_debug("TODO") call there.

Also dma_[un]map_resource() when brought in from drm-kmod/linuxkpi/bsd
(D30933) should be adjusted to pass the full arguments as the amdgpu
callers are requesting to skip synching.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45294

show more ...


# 2c7dd66d 13-Oct-2023 Olivier Certner <olce.freebsd@certner.fr>

linuxkpi: dma_get_cache_alignment(): Fix off-by-one result

Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()

linuxkpi: dma_get_cache_alignment(): Fix off-by-one result

Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()
was off by one, since it was defined to be the mask derived from the
alignment value.

Reviewed by: markj, bz
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42264

show more ...


# dc8f7692 13-Oct-2023 Olivier Certner <olce.freebsd@certner.fr>

uma: Hide 'uma_align_cache'; Create/rename accessors

Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
fil

uma: Hide 'uma_align_cache'; Create/rename accessors

Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
files that need only this function and not the whole 'uma.h' header.

Make sure the accessors have '_mask' as a suffix, so that callers are
aware that the real alignment is the power of two that is the mask plus
one. Rename the stem to something more explicit. Rename
uma_set_cache_align_mask()'s single parameter to 'mask'.

Hide 'uma_align_cache' to ensure that it cannot be set in any other way
then by a call to uma_set_cache_align_mask(), which will perform sanity
checks in a further commit. While here, rename it to
'uma_cache_align_mask'.

This is also in preparation for some further changes, such as improving
the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and
changing the type of the 'uma_cache_align_mask' variable.

Reviewed by: markj, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42258

show more ...


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# d1ea0764 31-Jul-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS

Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public

LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS

Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public Linux KPI interface to map to a native FreeBSD vm_page.

This should be a NOP.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41256

show more ...


# 72621b54 06-Dec-2022 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Fix style for dma_map_sgtable

Reported by: bz
Sponsored by: Beckhoff Automation GmbH & Co. KG


# 4085bde9 06-Dec-2022 Austin Shafer <ashafer@badland.io>

linuxkpi: Fix return value of dma_map_sgtable

dma_map_sgtable internally uses the dma_map_sg_attrs helper. The problem is
that dma_map_sg_attrs returns the number of entries mapped, whereas
dma_map_

linuxkpi: Fix return value of dma_map_sgtable

dma_map_sgtable internally uses the dma_map_sg_attrs helper. The problem is
that dma_map_sg_attrs returns the number of entries mapped, whereas
dma_map_sgtable returns nonzero on failure. This leads to dma_map_sgtable
returning non-zero-but-positive values which tricks other areas of the stack
into thinking nents is a valid pointer.

This checks if nents is valid and returns zero if so, updating the nents field
in sgt. This fixes PRIME render offload with nvidia-drm.

Fixes: 9202c95f47c2 ("linuxkpi: Add dma_{un,}map_sgtable")

show more ...


# 0b9bc973 23-Sep-2022 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add DMA_MAPPING_ERROR

While we deal with 0 returned, some drivers directly use and check for
DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error().

MFC after: 1 week

LinuxKPI: add DMA_MAPPING_ERROR

While we deal with 0 returned, some drivers directly use and check for
DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error().

MFC after: 1 week
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36686

show more ...


# f49fd63a 22-Sep-2022 John Baldwin <jhb@FreeBSD.org>

kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.

Reviewed by: kib, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D36549


# 7105f0d9 21-Sep-2022 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: dma-mapping: add dmam_alloc_coherent()

Add the devres version dmam_alloc_coherent() of dma_alloc_coherent()
along with the ancillary free function.

Sponsored by: The FreeBSD Foundation
MF

LinuxKPI: dma-mapping: add dmam_alloc_coherent()

Add the devres version dmam_alloc_coherent() of dma_alloc_coherent()
along with the ancillary free function.

Sponsored by: The FreeBSD Foundation
MFC after: 7 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36661

show more ...


# 9202c95f 09-Aug-2022 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Add dma_{un,}map_sgtable

Variant of dma_{un,}map_sg_attrs for struct sg_table.

Reviewed by: bz
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revisio

linuxkpi: Add dma_{un,}map_sgtable

Variant of dma_{un,}map_sg_attrs for struct sg_table.

Reviewed by: bz
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36106

show more ...


# 1acf9b27 29-Mar-2022 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Implement dma_max_mapping_size

Simply returns SCATTERLIST_MAX_SEGMENT.
Needed by drm v5.10

MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG


# 95edb10b 01-Oct-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: implement dma_sync_single_for_*, apply to (un)map single/sg

Implement dma_sync_single_for_{cpu,device} translating the Linux
DMA_ flags to BUS_DMASYNC_ combinations. Make map_single/unmap

LinuxKPI: implement dma_sync_single_for_*, apply to (un)map single/sg

Implement dma_sync_single_for_{cpu,device} translating the Linux
DMA_ flags to BUS_DMASYNC_ combinations. Make map_single/unmap_single*
functions call the respective sync function. Apply the same logic to
the scatter-gather list map/unmap functions.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32255

show more ...


# 307f78f3 19-Dec-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards

MFC after: 1 week
Reviewed by: bz, emaste, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33562


# c39eefe7 27-Sep-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: implement dma_set_coherent_mask()

Coherent is lower 32bit only by default in Linux and our only default
dma mask is 64bit currently which violates expectations unless
dma_set_coherent_mask

LinuxKPI: implement dma_set_coherent_mask()

Coherent is lower 32bit only by default in Linux and our only default
dma mask is 64bit currently which violates expectations unless
dma_set_coherent_mask() was called explicitly with a different mask.

Implement coherent by creating a second tag, and storing the tags in the
objects and use the tag from the object wherever possible.
This currently does not update the scatterlist or pool (both could be
converted but S/G cannot be MFCed as easily).

There is a 2nd change embedded in the updated logic of
linux_dma_alloc_coherent() to always zero the allocation as
otherwise some drivers get cranky on uninialised garbage.

Sponsored by: The FreeBSD Foundation
MFC after: 7 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32164

show more ...


# 72c89ce9 27-Sep-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: dma-mapping.h unify "mask" and "dma_mask"

In some places we are using "mask" and others "dma_mask" for the
same thing. Harmonize the various places to "dma_mask" as used in
linux_pci.c.

LinuxKPI: dma-mapping.h unify "mask" and "dma_mask"

In some places we are using "mask" and others "dma_mask" for the
same thing. Harmonize the various places to "dma_mask" as used in
linux_pci.c. For the declaration remove the argument names to
avoid the entire problem.

This is in preparation for an upcoming change.
No functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 5 days

show more ...


# 98a6984a 05-Jul-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Use macro for implementation of some dma_map_* functions

This allows to remove unimplemented attrs parameter which type differs
between Linux kernel versions and to compile both drm-kmod a

LinuxKPI: Use macro for implementation of some dma_map_* functions

This allows to remove unimplemented attrs parameter which type differs
between Linux kernel versions and to compile both drm-kmod and ofed
callers unmodified.
Also convert it to 'unsigned long' type to match modern Linuxes.

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D30932

show more ...


# 1a180032 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

compat: clean up empty lines in .c and .h files


# 440cec3f 12-Aug-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# e383ec74 06-Aug-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r363739 through r363986.


# 38ba9c8b 04-Aug-2020 Emmanuel Vadot <manu@FreeBSD.org>

Re-apply r363564.

We now have linux/sizes.h in the tree.


# cdb6eebe 26-Jul-2020 Emmanuel Vadot <manu@FreeBSD.org>

Revert r363564

linux/sizes.h doesn't exists in base ... sorry.


1234