blob: 23900689409ab164958452ea56fa3c7f8f268e48 (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*
* Copyright 2017 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Authors: Jérôme Glisse <jglisse@redhat.com>
*/
#ifndef COMPOTE_H
#define COMPOTE_H
#include <linux/list.h>
#include <linux/hmm.h>
#include "nouveau_drv.h"
#define COMPOTE_DEVICE_NAME "compote"
struct compote_device {
struct device *device;
struct nouveau_drm *nvdrm;
struct cdev cdev;
int minor;
uint8_t chipset;
};
struct compote_file {
struct compote_device *cdevice;
struct file *file;
struct nouveau_cli nvclient;
struct list_head channels;
struct rw_semaphore rwsem;
struct mm_struct *mm;
struct hmm_mirror mirror;
};
struct compote_mo {
struct kref kref;
struct compote_file *cfile;
struct list_head vas;
struct nouveau_bo *nvbo;
uint64_t npages;
uint64_t foffset;
};
struct compote_mo_va {
uint64_t start;
uint64_t end;
uint64_t pgoffset;
struct compote_mo *mo;
struct list_head list;
const struct vm_operations_struct *ttm_vm_ops;
};
struct compote_channel {
struct list_head list;
struct compote_file *cfile;
struct nouveau_channel *nvchan;
struct kref kref;
};
long compote_ioctl_mem_alloc(struct compote_file *cfile, void __user *uarg);
long compote_ioctl_mem_free(struct compote_file *cfile, void __user *uarg);
int compote_ioctl_channel_alloc(struct compote_file *cfile, void __user *uarg);
int compote_ioctl_channel_free(struct compote_file *cfile, void __user *uarg);
int compote_ioctl_channel_execute(struct compote_file *cfile,
void __user *uarg);
void compote_channel_ref(struct compote_channel *channel);
void compote_channel_unref(struct compote_channel *channel);
void compote_mo_ref(struct compote_mo *mo);
void compote_mo_unref(struct compote_mo *mo);
int compote_mo_mmap(struct compote_file *cfile,
struct vm_area_struct *vma,
struct file *file);
int compote_file_hmm_init(struct compote_file *cfile);
void compote_file_hmm_fini(struct compote_file *cfile);
#endif /* COMPOTE_H */
|