Skip to content

Commit d5a0c3b

Browse files
xyn-ackjannau
authored andcommitted
rust: add dma coherent allocator abstraction.
Add a simple dma coherent allocator rust abstraction. Based on Andreas Hindborg's dma abstractions from the rnvme driver, which was also based on earlier work by Wedson Almeida Filho. Nacked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@gmail.com>
1 parent eac92e9 commit d5a0c3b

5 files changed

Lines changed: 437 additions & 0 deletions

File tree

rust/bindings/bindings_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/blk_types.h>
1212
#include <linux/blkdev.h>
1313
#include <linux/cred.h>
14+
#include <linux/dma-mapping.h>
1415
#include <linux/errname.h>
1516
#include <linux/ethtool.h>
1617
#include <linux/file.h>

rust/helpers/dma.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include <linux/dma-mapping.h>
4+
5+
int rust_helper_dma_set_mask_and_coherent(struct device *dev, u64 mask)
6+
{
7+
return dma_set_mask_and_coherent(dev, mask);
8+
}
9+
10+
int rust_helper_dma_set_mask(struct device *dev, u64 mask)
11+
{
12+
return dma_set_mask(dev, mask);
13+
}

rust/helpers/helpers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "build_bug.c"
1414
#include "cred.c"
1515
#include "device.c"
16+
#include "dma.c"
1617
#include "err.c"
1718
#include "fs.c"
1819
#include "io.c"

0 commit comments

Comments
 (0)