-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathmemory.h
More file actions
66 lines (53 loc) · 2.1 KB
/
memory.h
File metadata and controls
66 lines (53 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc.
// SPDX-License-Identifier: GPL-2.0-only
#ifndef TENSTORRENT_MEMORY_H_INCLUDED
#define TENSTORRENT_MEMORY_H_INCLUDED
#include <linux/compiler.h>
#include <linux/scatterlist.h>
#define MAX_DMA_BUF_SIZE_LOG2 28
struct chardev_private;
struct tenstorrent_device;
struct tenstorrent_query_mappings;
struct tenstorrent_allocate_dma_buf;
struct tenstorrent_free_dma_buf;
struct tenstorrent_pin_pages;
struct tenstorrent_map_peer_bar;
struct vm_area_struct;
struct pinned_page_range {
struct list_head list;
unsigned long page_count;
struct page **pages; // vmalloc/vfree
struct sg_table dma_mapping; // alloc_chained_sgt_for_pages / free_chained_sgt
u64 virtual_address;
int outbound_iatu_region;
};
long ioctl_query_mappings(struct chardev_private *priv,
struct tenstorrent_query_mappings __user *arg);
long ioctl_allocate_dma_buf(struct chardev_private *priv,
struct tenstorrent_allocate_dma_buf __user *arg);
long ioctl_free_dma_buf(struct chardev_private *priv,
struct tenstorrent_free_dma_buf __user *arg);
long ioctl_pin_pages(struct chardev_private *priv,
struct tenstorrent_pin_pages __user *arg);
long ioctl_unpin_pages(struct chardev_private *priv,
struct tenstorrent_unpin_pages __user *arg);
long ioctl_map_peer_bar(struct chardev_private *priv,
struct tenstorrent_map_peer_bar __user *arg);
long ioctl_allocate_tlb(struct chardev_private *priv,
struct tenstorrent_allocate_tlb __user *arg);
long ioctl_free_tlb(struct chardev_private *priv,
struct tenstorrent_free_tlb __user *arg);
long ioctl_configure_tlb(struct chardev_private *priv,
struct tenstorrent_configure_tlb __user *arg);
int tenstorrent_mmap(struct chardev_private *priv, struct vm_area_struct *vma);
void tenstorrent_memory_cleanup(struct chardev_private *priv);
void tenstorrent_vma_zap(struct tenstorrent_device *tt_dev);
bool is_iommu_translated(struct device *dev);
#define TENSTORRENT_MAX_OUTBOUND_IATU_REGIONS 16
struct tenstorrent_outbound_iatu_region {
struct chardev_private *priv; // Owner of this region
u64 base;
u64 limit;
u64 target;
};
#endif