Hi Thomas, Natalie, T.J. and Philip,
could you guys take a look at this?
IIRC we wanted to do the same thing for TTM and DMA-buf heaps, but at least the TTM approach failed and we had to revert it.
If I'm not completely mistaken it should now work fine and is quite a nice performance improvement when mapping large stuff into the CPU page tables.
Regards,
Christian.
On 11/22/26 08:37, Qiliang Yuan wrote:
> QEMU and crosvm hand guest memory to the host renderer and display as
> udmabufs for virtio-gpu blob resources. The guest memory is a memfd that
> is often backed by 2 MiB huge pages, and the host process mmap()s the
> dma-buf to access it with the CPU.
>
> udmabuf maps every page with its own PTE: the first fault inserts a PFN
> for each 4 KiB page of the whole VMA. Mapping and touching 4 GiB this way
> takes over 200 ms and a million PTEs, although the memory behind it is
> 2048 huge pages.
>
> Add a ->huge_fault() handler that maps a PMD-sized range with one PMD
> when it is backed by an aligned run of contiguous PFNs, and falls back to
> PTEs otherwise. Have the pre-mapping on the first fault skip the ranges
> the handler will map, so that their PTEs don't take the place of the
> PMDs, and keep pre-mapping everything when the VMA can't have PMDs.
>
> Mapping a udmabuf over a memfd filled with data and reading a byte of
> each 4 KiB page through the mapping, base and patched kernels alternating
> over 3 rounds of 5 runs (7 for shmem 4K), median of the per-round medians
> and range in parentheses:
>
> backing size before (ms) after (ms) change
> hugetlb 256M 13.3 (13.3-13.7) 1.7 (1.7-1.8) -87%
> hugetlb 1G 53.6 (53.0-53.7) 6.5 (4.2-6.6) -88%
> hugetlb 4G 211 (211-212) 23.6 (17.6-25.2) -89%
> hugetlb 8G 423 (422-424) 45.8 (45.8-47.2) -89%
> shmem THP 1G 52.8 (52.5-53.1) 6.3 (5.8-6.8) -88%
> shmem THP 4G 210 (207-214) 20.7 (19.5-21.1) -90%
> shmem 4K 1G 52.0 (51.6-52.7) 51.8 (51.5-52.9) 0%
> shmem 4K 4G 209 (209-211) 208 (208-209) 0%
>
> Signed-off-by: Qiliang Yuan <qiliang.yuan(a)linux.dev>
> ---
> drivers/dma-buf/udmabuf.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 68 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
> index 018937435356e..f9c908f8b53a2 100644
> --- a/drivers/dma-buf/udmabuf.c
> +++ b/drivers/dma-buf/udmabuf.c
> @@ -44,12 +44,63 @@ struct udmabuf {
> struct miscdevice *device;
> };
>
> +/*
> + * Return whether the PMD-sized range of @vma at @addr is backed by one aligned
> + * run of contiguous PFNs, which can then be mapped with a single PMD.
> + */
> +static bool udmabuf_pmd_mappable(struct vm_area_struct *vma, unsigned long addr,
> + unsigned long *pfn)
> +{
> + struct udmabuf *ubuf = vma->vm_private_data;
> + const pgoff_t nr = PMD_SIZE >> PAGE_SHIFT;
> + unsigned long first;
> + pgoff_t pgoff, i;
> +
> + if (!IS_ENABLED(CONFIG_ARCH_SUPPORTS_PMD_PFNMAP))
> + return false;
> +
> + if (!IS_ALIGNED(addr, PMD_SIZE) || addr < vma->vm_start ||
> + vma->vm_end - addr < PMD_SIZE)
> + return false;
> +
> + pgoff = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT);
> + if (pgoff >= ubuf->pagecount || ubuf->pagecount - pgoff < nr)
> + return false;
> +
> + first = page_to_pfn(ubuf->pages[pgoff]);
> + if (!IS_ALIGNED(first, nr))
> + return false;
> +
> + for (i = 1; i < nr; i++) {
> + if (page_to_pfn(ubuf->pages[pgoff + i]) != first + i)
> + return false;
> + }
> +
> + *pfn = first;
> + return true;
> +}
> +
> +#ifdef CONFIG_ARCH_SUPPORTS_HUGE_PFNMAP
> +static vm_fault_t udmabuf_vm_huge_fault(struct vm_fault *vmf,
> + unsigned int order)
> +{
> + unsigned long pfn;
> +
> + if (order != PMD_ORDER ||
> + !udmabuf_pmd_mappable(vmf->vma, vmf->address & PMD_MASK, &pfn))
> + return VM_FAULT_FALLBACK;
> +
> + return vmf_insert_pfn_pmd(vmf, pfn, vmf->flags & FAULT_FLAG_WRITE);
> +}
> +#endif
> +
> static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
> {
> struct vm_area_struct *vma = vmf->vma;
> struct udmabuf *ubuf = vma->vm_private_data;
> pgoff_t pgoff = vmf->pgoff;
> unsigned long addr, pfn;
> + bool pmd_ok;
> vm_fault_t ret;
>
> if (pgoff >= ubuf->pagecount)
> @@ -61,7 +112,12 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
> if (ret & VM_FAULT_ERROR)
> return ret;
>
> - /* pre fault */
> + /*
> + * Pre-fault the rest of the VMA, except for the ranges that
> + * udmabuf_vm_huge_fault() maps with a PMD once they are accessed.
> + */
> + pmd_ok = thp_vma_allowable_order(vma, vma->vm_flags, TVA_PAGEFAULT,
> + PMD_ORDER);
> pgoff = vma->vm_pgoff;
> addr = vma->vm_start;
>
> @@ -69,6 +125,14 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
> if (addr == vmf->address)
> continue;
>
> + if (pmd_ok && IS_ALIGNED(addr, PMD_SIZE) &&
> + (vmf->address & PMD_MASK) != addr &&
> + udmabuf_pmd_mappable(vma, addr, &pfn)) {
> + pgoff += (PMD_SIZE >> PAGE_SHIFT) - 1;
> + addr += PMD_SIZE - PAGE_SIZE;
> + continue;
> + }
> +
> if (WARN_ON(pgoff >= ubuf->pagecount))
> break;
>
> @@ -89,6 +153,9 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
>
> static const struct vm_operations_struct udmabuf_vm_ops = {
> .fault = udmabuf_vm_fault,
> +#ifdef CONFIG_ARCH_SUPPORTS_HUGE_PFNMAP
> + .huge_fault = udmabuf_vm_huge_fault,
> +#endif
> };
>
> static int mmap_udmabuf(struct dma_buf *buf, struct vm_area_struct *vma)
>
> --
> 2.43.0
>
On 11/22/26 08:37, Qiliang Yuan wrote:
> A dma-buf exporter whose buffer is backed by physically contiguous memory
> can map it with PMDs from a ->huge_fault() handler, which only works where
> the user address and the buffer offset are aligned alike to PMD_SIZE.
>
> dma_buf_fops has no ->get_unmapped_area(), so mmap() places a dma-buf at
> whatever page aligned address the default allocator returns. A 4 GiB
> udmabuf, for one, lands 616 KiB past a 2 MiB boundary, and then none of
> its PMD-sized ranges can be mapped with a PMD.
>
> Use thp_get_unmapped_area(), as filesystems that support huge mappings
> do. It aligns a mapping that covers at least one whole PMD to the buffer
> offset and leaves smaller mappings where they would be placed anyway.
>
> Signed-off-by: Qiliang Yuan <qiliang.yuan(a)linux.dev>
Reviewed-by: Christian König <christian.koenig(a)amd.com>
> ---
> drivers/dma-buf/dma-buf.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 5c6957f8839a8..015a03c8d04db 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -608,6 +608,7 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
> static const struct file_operations dma_buf_fops = {
> .release = dma_buf_file_release,
> .mmap = dma_buf_mmap_internal,
> + .get_unmapped_area = thp_get_unmapped_area,
> .llseek = dma_buf_llseek,
> .poll = dma_buf_poll,
> .unlocked_ioctl = dma_buf_ioctl,
>
> --
> 2.43.0
>
Hi Olivier,
kernel test robot noticed the following build warnings:
[auto build test WARNING on d922ed738439e1d5b4701df7f4cdd49a09925624]
url: https://github.com/intel-lab-lkp/linux/commits/Olivier-Moysan/dt-bindings-i…
base: d922ed738439e1d5b4701df7f4cdd49a09925624
patch link: https://lore.kernel.org/r/20261118-upstream_mdf_v2-v2-8-7939d3c3720a%40foss…
patch subject: [PATCH v2 08/11] iio: adc: stm32-mdf: add dma buffered acquisition support
config: csky-allmodconfig (https://download.01.org/0day-ci/archive/20261121/202611210936.q9qVaCjc-lkp@…)
compiler: csky-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/202611210936.q9qVaCjc-lkp@…)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611210936.q9qVaCjc-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/iio/adc/stm32-mdf-adc.c:1781:12: warning: 'stm32_mdf_adc_resume' defined but not used [-Wunused-function]
1781 | static int stm32_mdf_adc_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/iio/adc/stm32-mdf-adc.c:1766:12: warning: 'stm32_mdf_adc_suspend' defined but not used [-Wunused-function]
1766 | static int stm32_mdf_adc_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
vim +/stm32_mdf_adc_resume +1781 drivers/iio/adc/stm32-mdf-adc.c
1765
> 1766 static int stm32_mdf_adc_suspend(struct device *dev)
1767 {
1768 struct iio_dev *indio_dev = dev_get_drvdata(dev);
1769 struct stm32_mdf_adc *adc = iio_priv(indio_dev);
1770 int ret = 0;
1771
1772 if (iio_buffer_enabled(indio_dev))
1773 ret = stm32_mdf_adc_predisable(indio_dev);
1774
1775 regcache_cache_only(adc->regmap, true);
1776 regcache_mark_dirty(adc->regmap);
1777
1778 return ret;
1779 }
1780
> 1781 static int stm32_mdf_adc_resume(struct device *dev)
1782 {
1783 struct iio_dev *indio_dev = dev_get_drvdata(dev);
1784 struct stm32_mdf_adc *adc = iio_priv(indio_dev);
1785 int ret;
1786
1787 regcache_cache_only(adc->regmap, false);
1788 ret = regcache_sync(adc->regmap);
1789
1790 if (!ret && iio_buffer_enabled(indio_dev))
1791 ret = stm32_mdf_adc_postenable(indio_dev);
1792
1793 return ret;
1794 }
1795
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Fri, Nov 13, 2026 at 03:06:13PM +0800, Mengmeng Zhao wrote:
> From: Mengmeng Zhao <zhaomengmeng(a)kylinos.cn>
>
> This series adds dma-buf read/write support for ext4. The dma-buf direct
> I/O infrastructure allows dma-buf to be handed to file I/O as an iov_iter,
> but currently it only supports raw block devices. To better serve the
> GPU-NVMe direct access through normal filesystems, prior work for XFS has
> been discussed at [1]. We are also interested in this field and working on
> it [2].
Can you an Anuj please work together and merge this into a single
series covering both XFS and ext4?
On Mon, Nov 16, 2026 at 03:21:01PM +0100, Andreas Hindborg wrote:
For the fs and pid_namespace bits:
Acked-by: Christian Brauner <brauner(a)kernel.org>
On Fri, Nov 13, 2026 at 03:06:19PM +0800, Mengmeng Zhao wrote:
> From: Mengmeng Zhao <zhaomengmeng(a)kylinos.cn>
>
> Add a file mode bit for files that can be the target of dma-buf I/O and
> require it when a buffer is registered. Block device files set it when
> the backing disk supports dma-buf I/O, and filesystems can set it for
> inodes whose data can be reached without the page cache. The bit is
> coarse: a driver that installs ->init_dma_buf_io_ctx for every
> namespace, like nvme, still decides per device at registration.
>
> dma_buf_io_ctx_create() is the only caller of ->init_dma_buf_io_ctx, so
> the capability and the O_DIRECT requirement are checked there for every
> file type rather than in each helper; O_DIRECT belongs at registration
> because F_SETFL can change it afterwards. Add bdev_can_dmabuf_io() so
> the open-time and registration checks share one predicate.
>
> Signed-off-by: Mengmeng Zhao <zhaomengmeng(a)kylinos.cn>
> Signed-off-by: Li Wang <liwang(a)kylinos.cn>
> ---
> block/bdev.c | 8 ++++----
> block/fops.c | 2 +-
> drivers/dma-buf/dma-buf-io.c | 13 +++++++++----
> include/linux/blkdev.h | 7 ++++++-
> include/linux/fs.h | 8 +++++++-
> 5 files changed, 27 insertions(+), 11 deletions(-)
>
> diff --git a/block/bdev.c b/block/bdev.c
> index 88e3f552f5d4..4e7a7f7e1e8b 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -61,14 +61,12 @@ struct block_device *file_bdev(struct file *bdev_file)
> }
> EXPORT_SYMBOL(file_bdev);
>
> -int bdev_init_dma_buf_io_ctx(struct file *file, struct block_device *bdev,
> +int bdev_init_dma_buf_io_ctx(struct block_device *bdev,
> struct dma_buf_io_ctx *ctx)
> {
> - if (!(file->f_flags & O_DIRECT))
> - return -EINVAL;
> if (ctx->dmabuf->size > UINT_MAX)
> return -EINVAL;
> - if (!bdev->bd_disk->fops->init_dma_buf_io_ctx)
> + if (!bdev_can_dmabuf_io(bdev))
> return -EOPNOTSUPP;
> return bdev->bd_disk->fops->init_dma_buf_io_ctx(bdev, ctx);
> }
> @@ -1041,6 +1039,8 @@ int bdev_open(struct block_device *bdev, blk_mode_t mode, void *holder,
>
> bdev_file->f_flags |= O_LARGEFILE;
> bdev_file->f_mode |= FMODE_CAN_ODIRECT;
> + if (bdev_can_dmabuf_io(bdev))
> + bdev_file->f_mode |= FMODE_CAN_DMABUF_IO;
> if (bdev_nowait(bdev))
> bdev_file->f_mode |= FMODE_NOWAIT;
> if (mode & BLK_OPEN_RESTRICT_WRITES)
> diff --git a/block/fops.c b/block/fops.c
> index 86bf1f298b79..7e5702e047a2 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -1008,7 +1008,7 @@ static int blkdev_mmap_prepare(struct vm_area_desc *desc)
> static int blkdev_init_dma_buf_io_ctx(struct file *file,
> struct dma_buf_io_ctx *ctx)
> {
> - return bdev_init_dma_buf_io_ctx(file, file_bdev(file), ctx);
> + return bdev_init_dma_buf_io_ctx(file_bdev(file), ctx);
> }
>
> const struct file_operations def_blk_fops = {
> diff --git a/drivers/dma-buf/dma-buf-io.c b/drivers/dma-buf/dma-buf-io.c
> index 8440151de860..9575b7d65ec5 100644
> --- a/drivers/dma-buf/dma-buf-io.c
> +++ b/drivers/dma-buf/dma-buf-io.c
> @@ -152,9 +152,11 @@ static void dma_buf_io_ctx_shutdown(struct dma_buf_io_ctx *ctx)
> * @out_ctx: [out] resulting ctx
> *
> * Create a new I/O context from the given DMA buffer for the given file.
> - * It only works with files implementing ->init_dma_buf_io_ctx and fails
> - * with -EOPNOTSUPP otherwise. Once created, the user can create a map
> - * and use it to issue I/O, such as read/write requests, to @file.
> + * It only works with files implementing ->init_dma_buf_io_ctx,
> + * advertising FMODE_CAN_DMABUF_IO and currently opened for direct I/O,
> + * and fails with -EOPNOTSUPP or -EINVAL otherwise. Once created, the
> + * user can create a map and use it to issue I/O, such as read/write
> + * requests, to @file.
> */
> int dma_buf_io_ctx_create(struct file *file,
> struct dma_buf *dmabuf,
> @@ -164,8 +166,11 @@ int dma_buf_io_ctx_create(struct file *file,
> struct dma_buf_io_ctx *ctx;
> int ret;
>
> - if (!file->f_op->init_dma_buf_io_ctx)
> + if (!file->f_op->init_dma_buf_io_ctx ||
> + !(file->f_mode & FMODE_CAN_DMABUF_IO))
> return -EOPNOTSUPP;
> + if (!(file->f_flags & O_DIRECT))
> + return -EINVAL;
>
> ctx = kzalloc_obj(*ctx);
> if (!ctx)
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index b98f43478cc0..0cfb6fb6b4e2 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1610,9 +1610,14 @@ struct block_device_operations {
> int (*alternative_gpt_sector)(struct gendisk *disk, sector_t *sector);
> };
>
> -int bdev_init_dma_buf_io_ctx(struct file *file, struct block_device *bdev,
> +int bdev_init_dma_buf_io_ctx(struct block_device *bdev,
> struct dma_buf_io_ctx *ctx);
>
> +static inline bool bdev_can_dmabuf_io(struct block_device *bdev)
> +{
> + return !!bdev->bd_disk->fops->init_dma_buf_io_ctx;
> +}
> +
> #ifdef CONFIG_COMPAT
> extern int blkdev_compat_ptr_ioctl(struct block_device *, blk_mode_t,
> unsigned int, unsigned long);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 99caef43ff3c..f5524fc770d4 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -121,7 +121,13 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
> /* File supports atomic writes */
> #define FMODE_CAN_ATOMIC_WRITE ((__force fmode_t)(1 << 7))
>
> -/* FMODE_* bit 8 */
> +/*
> + * File can be the target of dma-buf I/O. Set it for files whose data can be
> + * reached with direct I/O without the page cache: a dma-buf iterator has no
> + * pages to copy, so a buffered path cannot serve it. The bit is coarse; both
> + * the device behind it and O_DIRECT are checked when a buffer is registered.
> + */
> +#define FMODE_CAN_DMABUF_IO ((__force fmode_t)(1 << 8))
This is stealing yet another FMODE_* bit for special-purpose stuff.
We're really really short of them. Did Christoph suggest this?
On Wed, Nov 18, 2026 at 04:17:45PM +0100, Olivier Moysan wrote:
> This series adds support for the STM32 Multi-function Digital Filter
> (MDF) found on STM32MP2 SoCs. MDF converts bitstreams from external
> sigma-delta modulators and PDM microphones into samples for IIO and
> ASoC consumers.
>
> The drivers support direct IIO conversions, cyclic DMA acquisition,
> CIC configuration and scaling, synchronized and interleaved filters,
> and external timer triggers. An ASoC DAI provides PDM microphone capture.
>
> This revision addresses the v1 review comments listed below and splits
> the driver patch into smaller functional patches for readability.
> It retains the existing IIO backend interface for external sigma-delta
> modulators, pending agreement on the preferred abstraction.
>
> These changes do not resolve all v1 review comments. In particular, the
> frontend/backend architecture, DT child-node model and complete clock
> topology remain open discussion points.
>
> * Open questions: MDF topology (backend/frontend)
>
> In Analog Devices use of the IIO backend framework, the AXI ADC is a
> hardware backend, while the AD9467 is a hardware frontend. The external
> sigma-delta modulator is actually a hardware frontend in the MDF signal
> chain. The difference from the AD9467 use case is which driver owns the
> aggregate IIO device.
My red line here, that I probably made pretty clear on v1, is that what
is done needs to make sense when the ADC is feeding the MDF, it cannot
only work for the data coming in from sd modulators or w/e you connect
to the SITFx inputs.
> Option 1:
> One option would be to generalize the existing backend abstraction to
> represent components contributing to an aggregate IIO device,
> independently of their position in the signal chain.
>
> The existing framework appears to provide the required mechanisms. None
> of these mechanisms inherently requires the provider to be a hardware backend.
> A generic component/provider model would support both topologies without
> duplicating interfaces or requiring reciprocal dependencies. The key
> point here is to preserve the compatibility of APIs and DT bindings.
>
> Option 2:
> Alternatively, if the backend abstraction should retain its hardware
> meaning, we could introduce an explicit frontend-provider abstraction
> sharing the existing infrastructure. Frontend operations would cover
> analog-side control and conversion parameters.
>
> Would generalizing the existing abstraction be acceptable, or would a
> separate frontend interface built on shared infrastructure be preferred?
For either of these options, do you envisage the data being retrieved
from the mdf sysfs files rather than from the modulator?
>
> Option 3:
> An aggregate IIO device based on the component framework, as discussed
> in previous threads, could also be considered. I currently regard this
> as a fallback solution:
> https://lore.kernel.org/all/ec411432-4b77-4410-b0aa-b29f73b82c84@foss.st.co…
You option 2 in the earlier thread had:
| 2 - DFSDM managed as a "hardware accelerator"
|
|
| +-------------+
| | Sysfs |
| | - Scale | +---------------+
| | - Raw data | | IIO char dev |
| +-------------+ +---------------+
| ^ /\
| | ||
| | || Userland
| -----------------------------------------------------------
| | || IIO fw
| | ||
| | ||
| -----------------------------------------------------------
| | ||
| +--|-------------||--+ +----------------+
| | | || | | | Drivers
| | | ======================= |
| | | | | || |
| | +-----------------+-----+--+ || |
| | +---------+-----+--+ || |
| +----------|---------+ +-----------||---+
| | ||
| -----------------------------------------------------------
| | ||
| +----------|---------+ +-----------||---+
| | | | || | Hardware
| | sd modulator | | DFSDM || |
| ============================================= |
| | | | |
| +----------+---------+ +----------------+
| |
| |
| Vref
|
| The DFSDM is a consumer of the SD modulator.
|
| In addition to its complexity, the main drawback of this approach is
| that it is unsuitable for interleaved mode.
Two mails prior I had theorised a way to deal with the interleaved mode
https://lore.kernel.org/all/20261015-attentive-conflict-1a1f538de77d@spud/
but I never saw a response from you as to why something like that cannot
work. That's twice in that thread you said it was unsuitable without
providing the actual explanation for why?
Cheers,
Conor.
>
> * Driver implementation
>
> Serial interfaces (SITF) are shared resources managed directly by the
> MDF core and no longer have separate platform devices. This revision
> retains their DT nodes to describe configuration and clock connections,
> and to allow filters to reference their input bitstreams without
> duplicating shared settings.
>
> This revision also retains a platform device for each MDF filter, as
> each filter manages its own registers, interrupt, DMA channel and IIO
> acquisition state, with a separate suspend/resume lifecycle.
>
> * Clock management
>
> Several clock-management review comments are addressed in this revision:
> - The provider-side clock-frequency property has been removed. Consumers
> request CCK rates through assigned-clocks and assigned-clock-rates.
> - The clock-names property has been removed. The core acquires its single
> input clock by index, and CCK gating uses regmap-based clock operations.
> - Remove the unused clock-ranges property, as the core now explicitly
> shares the kernel clock with the serial interfaces and filters instead
> of relying on parent clock lookup.
>
> Clock topology point remains open, awaiting clarification of the MDF topology.
>
> Changes since v1:
> - Split the large IIO driver patch into smaller functional patches.
> - Replace provider-side clock-frequency with consumer-assigned CCK rates
> through the common clock framework.
> - Remove the platform devices for serial interfaces.
> - Replace the interleave phandle list with a filter count, covering
> consecutive filters starting at filter 0.
> - Simplify clock-output-names, remove clock-names, reset-names and
> filter-level clock properties, and move mdf-dai into an explicit
> property outside the conditional schema.
> - Rename the binding to match the STM32MP25 compatible, sort compatible
> entries, and simplify the binding patch subject.
> - Use unsigned long for match data, improve probe error reporting and
> wrapping, remove a probe-success debug message, and add kernel-doc for
> exported core functions.
> - Use scoped spinlock guards.
> - Remove empty serial-interface runtime-PM callbacks.
> - Remove the redundant ASoC platform module alias.
>
> Additional fixes since v1 (following Sashiko review):
> - Compute the settling-time discard count with 64-bit arithmetic.
> - Size cyclic DMA periods in complete scans and validate buffer and
> period alignment before starting DMA.
> - Fix backend-enable rollback so backend zero is disabled as well.
> - Use managed allocation for the conversion buffer and managed IIO
> triggered-buffer setup.
> - Release temporary synchronization and serial-interface firmware-node
> references. Replacing interleave phandles also removes the associated
> stored node references.
> - Avoid unregistering secondary interleaved filters that were never
> registered as IIO devices.
> - Use managed acquisition of the optional serial clock.
> - Replace the GCD-based CCK divider selection with a search for the
> largest valid divisor, allowing non-power-of-two divider values.
> - Remove the selection of the undefined COMMON_CLK_REGMAP symbol.
>
> Previous discussion:
> https://lore.kernel.org/all/20261001145702.2628429-1-olivier.moysan@foss.st…
>
> Signed-off-by: Olivier Moysan <olivier.moysan(a)foss.st.com>
> ---
> Olivier Moysan (11):
> dt-bindings: iio: adc: add stm32mp2 mdf filter
> iio: adc: stm32-mdf: add core registration
> iio: adc: stm32-mdf: add cck clocks provider
> iio: adc: stm32-mdf: add serial interfaces support
> iio: adc: stm32-mdf: add digital filter device support
> iio: adc: stm32-mdf: configure cic filters and sample rates
> iio: adc: stm32-mdf: add direct iio conversion support
> iio: adc: stm32-mdf: add dma buffered acquisition support
> iio: adc: stm32-mdf: add external timer trigger support
> iio: adc: stm32-mdf: add dmic audio filter support
> ASoC: stm32: add mdf dai support
>
> .../bindings/iio/adc/st,stm32mp25-mdf.yaml | 341 ++++
> drivers/iio/adc/Kconfig | 29 +
> drivers/iio/adc/Makefile | 3 +
> drivers/iio/adc/stm32-mdf-adc.c | 2080 ++++++++++++++++++++
> drivers/iio/adc/stm32-mdf-core.c | 899 +++++++++
> drivers/iio/adc/stm32-mdf-serial.c | 223 +++
> drivers/iio/adc/stm32-mdf.h | 275 +++
> include/linux/iio/adc/stm32-mdf-adc.h | 19 +
> sound/soc/stm/Kconfig | 15 +
> sound/soc/stm/Makefile | 3 +
> sound/soc/stm/stm32_amdf.c | 375 ++++
> 11 files changed, 4262 insertions(+)
> ---
> base-commit: d922ed738439e1d5b4701df7f4cdd49a09925624
> change-id: 20261112-upstream_mdf_v2-76040d99138e
>
> Best regards,
> --
> Olivier Moysan <olivier.moysan(a)foss.st.com>
>
On Tue, Nov 17, 2026 at 11:54 PM Paul Moore <paul(a)paul-moore.com> wrote:
>
> On Nov 17, 2026 Albert Esteve <aesteve(a)redhat.com> wrote:
> >
> > Both DMA_HEAP_IOCTL_ALLOC and the new DMA_BUF_IOCTL_XFER_CHARGE ioctl
> > accept a charge_fd field that, when set, causes the allocation to be
> > charged to an arbitrary process's cgroup rather than the caller's.
> >
> > Charging is currently limited to the caller's own memcg subtree unless
> > the caller holds CAP_SYS_RESOURCE. But the capability is all-or-nothing.
> > A process holding it, along with a dma-heap device node or a dma-buf
> > fd can charge unlimited memory to any other process's cgroup, potentially
> > exhausting that cgroup's limit and triggering OOM kills independent of
> > the victim's own activity or privileges.
> >
> > Add security_memcg_charge_task(), called in get_obj_cgroup_from_fd()
> > when charge_fd refers to another process. The hook receives
> > the credentials of the allocating process (from) and the credentials
> > of the process whose cgroup will be charged (to), giving security
> > modules a controlled enforcement point for cross-cgroup objcg
> > attribution policy.
> >
> > When CONFIG_SECURITY is not set the hook compiles to an inline
> > returning 0, adding no overhead to the fast path.
> >
> > Signed-off-by: Albert Esteve <aesteve(a)redhat.com>
> > ---
> > include/linux/lsm_hook_defs.h | 1 +
> > include/linux/security.h | 7 +++++++
> > mm/memcontrol.c | 11 +++++++++++
> > security/security.c | 15 +++++++++++++++
> > 4 files changed, 34 insertions(+)
>
> ...
>
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 03cd90d5e623..2e6fcbe14d43 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -60,6 +60,7 @@
> > #include <linux/lockdep.h>
> > #include <linux/resume_user_mode.h>
> > #include <linux/psi.h>
> > +#include <linux/security.h>
> > #include <linux/seq_buf.h>
> > #include <linux/sched/isolation.h>
> > #include <linux/kmemleak.h>
> > @@ -3198,10 +3199,12 @@ static bool mem_cgroup_may_charge(struct mem_cgroup *memcg)
> > struct obj_cgroup *get_obj_cgroup_from_fd(int fd)
> > {
> > struct cgroup_subsys_state *css;
> > + const struct cred *tcred;
> > struct obj_cgroup *objcg;
> > struct mem_cgroup *memcg;
> > struct task_struct *task;
> > unsigned int pidfd_flags;
> > + int ret;
> >
> > if (mem_cgroup_disabled())
> > return ERR_PTR(-EOPNOTSUPP);
> > @@ -3226,6 +3229,14 @@ struct obj_cgroup *get_obj_cgroup_from_fd(int fd)
> > if (IS_ERR(task))
> > return ERR_CAST(task);
> >
> > + tcred = get_task_cred(task);
> > + ret = security_memcg_charge_task(current_cred(), tcred);
>
> Do you ever envision this "from" cred being something other than
> current_cred()?
Good point. No, I do not.
> If the answer is "no", we might want to consider changing
> the LSM hook slightly to help prevent misuse in the future:
>
> int security_current_memcg_charge_task(const struct cred *tcred);
Agreed. I'll apply the same to the cgroupfd variant for symmetry (its
"from" is also always current_cred()).
BR,
Albert.
>
> > + put_cred(tcred);
> > + if (ret) {
> > + put_task_struct(task);
> > + return ERR_PTR(ret);
> > + }
> > +
> > rcu_read_lock();
> > css = task_css(task, memory_cgrp_id);
> > put_task_struct(task);
>
> --
> paul-moore.com
>