diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2025-04-01 14:51:03 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2025-06-03 18:35:09 +0000 |
| commit | a02180cf60a6a0102669b678e9c81ad9f1aa4d91 (patch) | |
| tree | 45abf9916b6f934c4c2dbb64ad9b111f768fc774 | |
| parent | f99d393f7f787ff080c12b92243adcc310ac7c58 (diff) | |
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
| -rw-r--r-- | UPDATING | 4 | ||||
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/dma-mapping.h | 14 | ||||
| -rw-r--r-- | sys/sys/param.h | 2 |
3 files changed, 19 insertions, 1 deletions
@@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20250603: + LinuxKPI dma-mapping.h were pulled into the tree from drm-kmod. + Bump _FreeBSD_version to 1500045 to be able to detect this change. + 20250527: The CAM target layer userland, i.e. ctld(8), ctladm(8) and ctlstat(8), has moved to the new FreeBSD-ctl package. If you use pkgbase and you diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index 09d5e4b6bc22..2d8e1196d3d3 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -214,6 +214,20 @@ dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, lkpi_dma_unmap(dev, dma_address, size, direction, 0); } +static inline dma_addr_t +dma_map_resource(struct device *dev, phys_addr_t paddr, size_t size, + enum dma_data_direction direction, unsigned long attrs) +{ + return (lkpi_dma_map_phys(dev, paddr, size, direction, attrs)); +} + +static inline void +dma_unmap_resource(struct device *dev, dma_addr_t dma, size_t size, + enum dma_data_direction direction, unsigned long attrs) +{ + lkpi_dma_unmap(dev, dma, size, direction, attrs); +} + static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma, size_t size, enum dma_data_direction direction) diff --git a/sys/sys/param.h b/sys/sys/param.h index 0a08d4740593..98fb0aeacef0 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -73,7 +73,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500044 +#define __FreeBSD_version 1500045 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, |
